Class: Flico::Cell

Inherits:
Object
  • Object
show all
Defined in:
lib/flico/cell.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#heightObject (readonly)

Returns the value of attribute height.



5
6
7
# File 'lib/flico/cell.rb', line 5

def height
  @height
end

#widthObject (readonly)

Returns the value of attribute width.



5
6
7
# File 'lib/flico/cell.rb', line 5

def width
  @width
end

#xObject (readonly)

Returns the value of attribute x.



5
6
7
# File 'lib/flico/cell.rb', line 5

def x
  @x
end

#yObject (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_ratioObject



14
15
16
# File 'lib/flico/cell.rb', line 14

def aspect_ratio
  width.to_f / height
end

#to_mmObject



18
19
20
# File 'lib/flico/cell.rb', line 18

def to_mm
  "#{width}x#{height}+#{x}+#{y}"
end