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.



8
9
10
11
12
# File 'lib/mosaiq/svg.rb', line 8

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

Instance Method Details

#rawObject



14
15
16
# File 'lib/mosaiq/svg.rb', line 14

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

#to_base64Object



18
19
20
# File 'lib/mosaiq/svg.rb', line 18

def to_base64
  Base64.encode64(raw).delete("\n")
end