Class: SVGCreator

Inherits:
Object
  • Object
show all
Defined in:
lib/teaching_printables/svg/svg_creator.rb

Instance Method Summary collapse

Constructor Details

#initialize(width, height) ⇒ SVGCreator

Use SVGCreator to add svg components to an array Method ‘svg’ concatenates the array elements, adds header and footer, and returns svg string



7
8
9
10
11
# File 'lib/teaching_printables/svg/svg_creator.rb', line 7

def initialize(width,height)
  @width = width
  @height = height
  @components = []
end

Instance Method Details

#svgObject



13
14
15
16
17
# File 'lib/teaching_printables/svg/svg_creator.rb', line 13

def svg
  @components.insert(0,SVGComponents::header(@width,@height))
  @components << SVGComponents::footer
  return @components.join
end