Class: Icodi

Inherits:
Victor::SVGBase
  • Object
show all
Includes:
IcodiCore::Options, IcodiCore::Randomization
Defined in:
lib/icodi.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from IcodiCore::Randomization

#random, #random_sets, #seed

Methods included from IcodiCore::Options

#background, #color, #default_options, #density, #id, #jitter, #mirror, #mirror_both?, #mirror_x?, #mirror_y?, #pixels, #size, #stroke, #style

Constructor Details

#initialize(text = nil, opts = {}) ⇒ Icodi

Returns a new instance of Icodi.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/icodi.rb', line 12

def initialize(text = nil, opts = {})
  if text.is_a? Hash
    opts = text
    text = nil
  end

  svg_template = opts.delete :template

  @text = text
  @options = default_options.merge opts

  super template: svg_template, viewBox: "0 0 #{size} #{size}", id: id

  generate
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



10
11
12
# File 'lib/icodi.rb', line 10

def options
  @options
end

#textObject (readonly)

Returns the value of attribute text.



10
11
12
# File 'lib/icodi.rb', line 10

def text
  @text
end