Class: RubyHoldem::Round::MoveHistory
- Inherits:
-
Object
- Object
- RubyHoldem::Round::MoveHistory
- Defined in:
- lib/ruby_holdem/round/move_history.rb
Instance Attribute Summary collapse
-
#moves ⇒ Object
readonly
Returns the value of attribute moves.
-
#stage ⇒ Object
readonly
Returns the value of attribute stage.
Instance Method Summary collapse
- #add_move(move) ⇒ Object
-
#initialize ⇒ MoveHistory
constructor
A new instance of MoveHistory.
- #last_move ⇒ Object
- #next_stage ⇒ Object
- #turns_played ⇒ Object
Constructor Details
#initialize ⇒ MoveHistory
Returns a new instance of MoveHistory.
6 7 8 9 |
# File 'lib/ruby_holdem/round/move_history.rb', line 6 def initialize @moves = [] @stage = STAGES.first end |
Instance Attribute Details
#moves ⇒ Object (readonly)
Returns the value of attribute moves.
4 5 6 |
# File 'lib/ruby_holdem/round/move_history.rb', line 4 def moves @moves end |
#stage ⇒ Object (readonly)
Returns the value of attribute stage.
4 5 6 |
# File 'lib/ruby_holdem/round/move_history.rb', line 4 def stage @stage end |
Instance Method Details
#add_move(move) ⇒ Object
11 12 13 |
# File 'lib/ruby_holdem/round/move_history.rb', line 11 def add_move(move) moves << move end |
#last_move ⇒ Object
15 16 17 |
# File 'lib/ruby_holdem/round/move_history.rb', line 15 def last_move moves.last end |
#next_stage ⇒ Object
23 24 25 |
# File 'lib/ruby_holdem/round/move_history.rb', line 23 def next_stage @stage = STAGES[STAGES.index(stage)+1] end |
#turns_played ⇒ Object
19 20 21 |
# File 'lib/ruby_holdem/round/move_history.rb', line 19 def turns_played moves.count end |