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.



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

#heightObject (readonly)

Returns the value of attribute height.



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

def height
  @height
end

#widthObject (readonly)

Returns the value of attribute width.



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

def width
  @width
end

#xObject (readonly)

Returns the value of attribute x.



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

def x
  @x
end

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



11
12
13
# File 'lib/flico/cell.rb', line 11

def aspect_ratio
	width.to_f / height.to_f
end

#to_mmObject



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

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