Class: Phantom::SVG::Frame::ViewBox

Inherits:
Object
  • Object
show all
Defined in:
lib/phantom/frame.rb

Overview

ViewBox helper.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#heightObject

Returns the value of attribute height.



18
19
20
# File 'lib/phantom/frame.rb', line 18

def height
  @height
end

#widthObject

Returns the value of attribute width.



18
19
20
# File 'lib/phantom/frame.rb', line 18

def width
  @width
end

#xObject

Returns the value of attribute x.



18
19
20
# File 'lib/phantom/frame.rb', line 18

def x
  @x
end

#yObject

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_sObject



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