Class: Checkers::Game::State
- Inherits:
-
Object
- Object
- Checkers::Game::State
- Includes:
- Observable
- Defined in:
- lib/checkers/game/state.rb
Instance Attribute Summary collapse
-
#board ⇒ Object
readonly
Returns the value of attribute board.
-
#tie ⇒ Object
readonly
Returns the value of attribute tie.
-
#turn ⇒ Object
readonly
Returns the value of attribute turn.
-
#winner ⇒ Object
readonly
Returns the value of attribute winner.
Instance Method Summary collapse
-
#initialize(turn) ⇒ State
constructor
A new instance of State.
- #set_state(attrs = {}) ⇒ Object
Constructor Details
Instance Attribute Details
#board ⇒ Object
Returns the value of attribute board.
8 9 10 |
# File 'lib/checkers/game/state.rb', line 8 def board @board end |
#tie ⇒ Object
Returns the value of attribute tie.
8 9 10 |
# File 'lib/checkers/game/state.rb', line 8 def tie @tie end |
#turn ⇒ Object
Returns the value of attribute turn.
8 9 10 |
# File 'lib/checkers/game/state.rb', line 8 def turn @turn end |
#winner ⇒ Object
Returns the value of attribute winner.
8 9 10 |
# File 'lib/checkers/game/state.rb', line 8 def winner @winner end |
Instance Method Details
#set_state(attrs = {}) ⇒ Object
18 19 20 21 22 |
# File 'lib/checkers/game/state.rb', line 18 def set_state(attrs = {}) changed attrs.each { |attr, value| send("#{attr}=", value) } notify_observers end |