class Cell
class Cell
describes cell state
Attributes
state[RW]
Public Class Methods
new(col, row, st = EMPTY)
click to toggle source
# File lib/sea_battle/cell.rb, line 13 def initialize(col, row, st = EMPTY) @state = st @col = col @row = row end
Public Instance Methods
state=(new_st)
click to toggle source
# File lib/sea_battle/cell.rb, line 19 def state=(new_st) if (State.constants.collect { |sym| State.const_get sym }).include? new_st @state = new_st else fail TypeError end end
to_s()
click to toggle source
# File lib/sea_battle/cell.rb, line 27 def to_s "Cell [#{@col}:#{@row}] State = #{@state}" end