Class: Waxy::Render::Svg::Canvas

Inherits:
Object
  • Object
show all
Defined in:
lib/waxy/render/canvas.rb

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_width = 1000, _height = 1000) ⇒ Canvas

Returns a new instance of Canvas.



11
12
13
14
15
16
# File 'lib/waxy/render/canvas.rb', line 11

def initialize(_width = 1000, _height = 1000)
  @width = _width
  @height = _height 

  @body = ''
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



9
10
11
# File 'lib/waxy/render/canvas.rb', line 9

def body
  @body
end

#heightObject

Returns the value of attribute height.



8
9
10
# File 'lib/waxy/render/canvas.rb', line 8

def height
  @height
end

#widthObject

Returns the value of attribute width.



8
9
10
# File 'lib/waxy/render/canvas.rb', line 8

def width
  @width
end

Instance Method Details

#to_svgObject



18
19
20
21
22
23
# File 'lib/waxy/render/canvas.rb', line 18

def to_svg
  doc = Waxy::Render::Svg.open_svg(self)
  doc << body 
  doc << Waxy::Render::Svg.close_svg
  doc
end