Class: Phantom::SVG::Frame::ViewBox
- Inherits:
-
Object
- Object
- Phantom::SVG::Frame::ViewBox
- Defined in:
- lib/phantom/frame.rb
Overview
ViewBox helper.
Instance Attribute Summary collapse
-
#height ⇒ Object
Returns the value of attribute height.
-
#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(x = 0, y = 0, width = 64, height = 64) ⇒ ViewBox
constructor
A new instance of ViewBox.
- #set_from_text(text) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(x = 0, y = 0, width = 64, height = 64) ⇒ ViewBox
Returns a new instance of ViewBox.
20 21 22 23 24 25 |
# File 'lib/phantom/frame.rb', line 20 def initialize(x = 0, y = 0, width = 64, height = 64) @x = x @y = y @width = width @height = height end |
Instance Attribute Details
#height ⇒ Object
Returns the value of attribute height.
18 19 20 |
# File 'lib/phantom/frame.rb', line 18 def height @height end |
#width ⇒ Object
Returns the value of attribute width.
18 19 20 |
# File 'lib/phantom/frame.rb', line 18 def width @width end |
#x ⇒ Object
Returns the value of attribute x.
18 19 20 |
# File 'lib/phantom/frame.rb', line 18 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
18 19 20 |
# File 'lib/phantom/frame.rb', line 18 def y @y end |
Instance Method Details
#set_from_text(text) ⇒ Object
27 28 29 30 31 |
# File 'lib/phantom/frame.rb', line 27 def set_from_text(text) values = text.split(' ', 4) initialize(values[0].to_i, values[1].to_i, values[2].to_i, values[3].to_i) self end |
#to_s ⇒ Object
33 34 35 |
# File 'lib/phantom/frame.rb', line 33 def to_s "#{@x.to_i} #{@y.to_i} #{@width.to_i} #{@height.to_i}" end |