Class: Cell
Overview
class Cell describes cell state
Constant Summary
Constants included from State
State::BROKEN, State::EMPTY, State::MISSED, State::SHIP
Instance Attribute Summary collapse
-
#state ⇒ Object
Returns the value of attribute state.
Instance Method Summary collapse
-
#initialize(col, row, st = EMPTY) ⇒ Cell
constructor
A new instance of Cell.
- #to_s ⇒ Object
Constructor Details
#initialize(col, row, st = EMPTY) ⇒ Cell
Returns a new instance of Cell.
13 14 15 16 17 |
# File 'lib/cell.rb', line 13 def initialize(col, row, st = EMPTY) @state = st @col = col @row = row end |
Instance Attribute Details
#state ⇒ Object
Returns the value of attribute state.
12 13 14 |
# File 'lib/cell.rb', line 12 def state @state end |
Instance Method Details
#to_s ⇒ Object
27 28 29 |
# File 'lib/cell.rb', line 27 def to_s "Cell [#{@col}:#{@row}] State = #{@state}" end |