class BoringAvatar::Base

Constants

COLORS
NAME
SIZE

Attributes

colors[R]
name[R]
num_from_name[R]
opts[R]
range[R]
size[R]

Public Class Methods

new(colors: COLORS, name: NAME, size: SIZE, **opts) click to toggle source
# File lib/boring_avatar/avatar/base.rb, line 11
def initialize(colors: COLORS, name: NAME, size: SIZE, **opts)
  @colors = colors
  @name = name
  @size = size
  @opts = opts
  @num_from_name = Util.get_number(name)
  @range = colors.length
end

Public Instance Methods

generate() click to toggle source
# File lib/boring_avatar/avatar/base.rb, line 20
def generate
  raise NotImplementedError
end

Private Instance Methods

render_svg(text) click to toggle source
# File lib/boring_avatar/avatar/base.rb, line 26
def render_svg(text)
  text
    .gsub(/>\s+</, "><")
    .gsub(/\s+/, " ")
    .strip
end