Class: Mosaiq::Svg

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

Overview

Generate SVG version of the Mosaiq

Instance Method Summary collapse

Constructor Details

#initialize(canvas) ⇒ Svg

Returns a new instance of Svg.



6
7
8
9
10
# File 'lib/mosaiq/svg.rb', line 6

def initialize(canvas)
  @canvas = canvas
  @width = canvas[0].count
  @height = canvas.count
end

Instance Method Details

#generateObject



12
13
14
# File 'lib/mosaiq/svg.rb', line 12

def generate
  %(#{svg_header} #{svg_body}).tr("\n", '').gsub(/ +/, ' ')
end