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
- #==(other) ⇒ 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.
7 8 9 10 11 12 |
# File 'lib/flico/cell.rb', line 7 def initialize(x = 0, y = 0, width, height) @x = x @y = y @width = width @height = height end |
Instance Attribute Details
#height ⇒ Object (readonly)
Returns the value of attribute height.
5 6 7 |
# File 'lib/flico/cell.rb', line 5 def height @height end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
5 6 7 |
# File 'lib/flico/cell.rb', line 5 def width @width end |
#x ⇒ Object (readonly)
Returns the value of attribute x.
5 6 7 |
# File 'lib/flico/cell.rb', line 5 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
5 6 7 |
# File 'lib/flico/cell.rb', line 5 def y @y end |
Instance Method Details
#==(other) ⇒ Object
22 23 24 |
# File 'lib/flico/cell.rb', line 22 def ==(other) other.class == self.class && other.state == state end |
#aspect_ratio ⇒ Object
14 15 16 |
# File 'lib/flico/cell.rb', line 14 def aspect_ratio width.to_f / height end |
#to_mm ⇒ Object
18 19 20 |
# File 'lib/flico/cell.rb', line 18 def to_mm "#{width}x#{height}+#{x}+#{y}" end |