Class: AcpcPokerMatchState::MatchStateTransition
- Inherits:
-
Object
- Object
- AcpcPokerMatchState::MatchStateTransition
- Defined in:
- lib/acpc_poker_match_state/match_state_transition.rb
Instance Attribute Summary collapse
-
#last_state ⇒ Object
readonly
Returns the value of attribute last_state.
-
#next_state ⇒ Object
readonly
Returns the value of attribute next_state.
Instance Method Summary collapse
- #initial_state? ⇒ Boolean
-
#new_round? ⇒ Boolean
true
if the next state’s round is different from the last,false
otherwise. - #set_next_state!(new_state) ⇒ Object
Instance Attribute Details
#last_state ⇒ Object (readonly)
Returns the value of attribute last_state.
11 12 13 |
# File 'lib/acpc_poker_match_state/match_state_transition.rb', line 11 def last_state @last_state end |
#next_state ⇒ Object (readonly)
Returns the value of attribute next_state.
10 11 12 |
# File 'lib/acpc_poker_match_state/match_state_transition.rb', line 10 def next_state @next_state end |
Instance Method Details
#initial_state? ⇒ Boolean
28 29 30 31 32 |
# File 'lib/acpc_poker_match_state/match_state_transition.rb', line 28 def initial_state? raise NoStateGiven unless @next_state @next_state.first_state_of_first_round? end |
#new_round? ⇒ Boolean
Returns true
if the next state’s round is different from the last, false
otherwise.
21 22 23 24 25 26 |
# File 'lib/acpc_poker_match_state/match_state_transition.rb', line 21 def new_round? raise NoStateGiven unless @next_state return true unless @last_state @next_state.round != @last_state.round end |
#set_next_state!(new_state) ⇒ Object
13 14 15 16 17 |
# File 'lib/acpc_poker_match_state/match_state_transition.rb', line 13 def set_next_state!(new_state) @last_state = @next_state @next_state = new_state self end |