Class: Flico::Cell
- Inherits:
-
Object
- Object
- Flico::Cell
- Defined in:
- lib/flico/cell.rb
Instance Attribute Summary collapse
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Instance Method Summary collapse
- #==(o) ⇒ Object
- #aspect_ratio ⇒ Object
-
#initialize(x = 0, y = 0, width, height) ⇒ Cell
constructor
A new instance of Cell.
- #to_mm ⇒ Object
Constructor Details
#initialize(x = 0, y = 0, width, height) ⇒ Cell
Returns a new instance of Cell.
6 7 8 9 |
# File 'lib/flico/cell.rb', line 6 def initialize(x=0, y=0, width, height) @x, @y = x, y @width, @height = width, height end |
Instance Attribute Details
#height ⇒ Object (readonly)
Returns the value of attribute height.
4 5 6 |
# File 'lib/flico/cell.rb', line 4 def height @height end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
4 5 6 |
# File 'lib/flico/cell.rb', line 4 def width @width end |
#x ⇒ Object (readonly)
Returns the value of attribute x.
4 5 6 |
# File 'lib/flico/cell.rb', line 4 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
4 5 6 |
# File 'lib/flico/cell.rb', line 4 def y @y end |
Instance Method Details
#==(o) ⇒ Object
19 20 21 |
# File 'lib/flico/cell.rb', line 19 def ==(o) o.class == self.class && o.state == state end |
#aspect_ratio ⇒ Object
11 12 13 |
# File 'lib/flico/cell.rb', line 11 def aspect_ratio width.to_f / height.to_f end |
#to_mm ⇒ Object
15 16 17 |
# File 'lib/flico/cell.rb', line 15 def to_mm "#{width}x#{height}+#{x}+#{y}" end |