Class: Prune::Shapes::Base
- Inherits:
-
Object
- Object
- Prune::Shapes::Base
- Defined in:
- lib/prune/shapes/base.rb
Instance Attribute Summary collapse
-
#height ⇒ Object
Returns the value of attribute height.
-
#id ⇒ Object
Returns the value of attribute id.
-
#width ⇒ Object
Returns the value of attribute width.
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Instance Method Summary collapse
-
#initialize(page) ⇒ Base
constructor
Initialize.
-
#render(stream) ⇒ Object
Render shapes.
Methods included from Functions
Constructor Details
#initialize(page) ⇒ Base
Initialize.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/prune/shapes/base.rb', line 16 def initialize(page) @page = page @document = @page.document raise DuplicateIdError if @page.shape_ids.include?(id) @id = "shape_#{@page.shape_ids.size}".to_sym @x = 0.0 @y = 0.0 @width = 0.0 @height = 0.0 end |
Instance Attribute Details
#height ⇒ Object
Returns the value of attribute height.
13 14 15 |
# File 'lib/prune/shapes/base.rb', line 13 def height @height end |
#id ⇒ Object
Returns the value of attribute id.
9 10 11 |
# File 'lib/prune/shapes/base.rb', line 9 def id @id end |
#width ⇒ Object
Returns the value of attribute width.
12 13 14 |
# File 'lib/prune/shapes/base.rb', line 12 def width @width end |
#x ⇒ Object
Returns the value of attribute x.
10 11 12 |
# File 'lib/prune/shapes/base.rb', line 10 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
11 12 13 |
# File 'lib/prune/shapes/base.rb', line 11 def y @y end |
Instance Method Details
#render(stream) ⇒ Object
Render shapes.
28 29 30 31 32 33 |
# File 'lib/prune/shapes/base.rb', line 28 def render(stream) stream.each{|line| @page.stream << line} @page.shape_ids << @id @page.shapes.update(@id => self) self end |