class Gingham::Cell
Attributes
is_ground[RW]
is_occupied[RW]
x[RW]
y[RW]
z[RW]
Public Class Methods
new(x = 0, y = 0, z = 0)
click to toggle source
# File lib/gingham/cell.rb, line 5 def initialize(x = 0, y = 0, z = 0) @x, @y, @z = x.to_i, y.to_i, z.to_i @is_occupied = false @is_ground = false end
Public Instance Methods
==(other)
click to toggle source
# File lib/gingham/cell.rb, line 11 def ==(other) other.is_a?(Gingham::Cell) && @x == other.x && @y == other.y && @z == other.z end
ground?()
click to toggle source
# File lib/gingham/cell.rb, line 27 def ground? @is_ground end
inspect()
click to toggle source
# File lib/gingham/cell.rb, line 35 def inspect "(#{x},#{y},#{z})" end
occupied?()
click to toggle source
# File lib/gingham/cell.rb, line 15 def occupied? @is_occupied end
passable?()
click to toggle source
# File lib/gingham/cell.rb, line 19 def passable? !@is_occupied end
set_ground()
click to toggle source
# File lib/gingham/cell.rb, line 39 def set_ground @is_ground = true self end
sky?()
click to toggle source
# File lib/gingham/cell.rb, line 23 def sky? !@is_ground end
to_s()
click to toggle source
# File lib/gingham/cell.rb, line 31 def to_s "(#{x},#{y},#{z})" end