Class: Mosaiq::Svg
- Inherits:
-
Object
- Object
- Mosaiq::Svg
- Defined in:
- lib/mosaiq/svg.rb
Overview
Generate SVG version of the Mosaiq
Instance Method Summary collapse
-
#initialize(canvas) ⇒ Svg
constructor
A new instance of Svg.
- #raw ⇒ Object
- #to_base64 ⇒ Object
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
#raw ⇒ Object
14 15 16 |
# File 'lib/mosaiq/svg.rb', line 14 def raw %(#{svg_header}#{svg_body}).delete("\n").gsub(/ +/, ' ') end |
#to_base64 ⇒ Object
18 19 20 |
# File 'lib/mosaiq/svg.rb', line 18 def to_base64 Base64.encode64(raw).delete("\n") end |