Class: Mocha::StateMachine
Overview
Defined Under Namespace
Classes: State, StatePredicate
Instance Method Summary (collapse)
-
- (Object) become(next_state_name)
Put the StateMachine into the next_state_name.
-
- (State) is(state_name)
Provides a mechanism to change the StateMachine into the state specified by state_name at some point in the future.
-
- (Object) is_not(state_name)
Provides a mechanism to determine whether the StateMachine is not in the state specified by state_name at some point in the future.
-
- (StateMachine) starts_as(initial_state_name)
Put the StateMachine into the state specified by initial_state_name.
Instance Method Details
- (Object) become(next_state_name)
Put the Mocha::StateMachine into the next_state_name.
76 77 78 |
# File 'lib/mocha/state_machine.rb', line 76 def become(next_state_name) @current_state = next_state_name end |
- (State) is(state_name)
Provides a mechanism to change the Mocha::StateMachine into the state specified by state_name at some point in the future.
Or provides a mechanism to determine whether the Mocha::StateMachine is in the state specified by state_name at some point in the future.
86 87 88 |
# File 'lib/mocha/state_machine.rb', line 86 def is(state_name) State.new(self, state_name) end |
- (Object) is_not(state_name)
Provides a mechanism to determine whether the Mocha::StateMachine is not in the state specified by state_name at some point in the future.
91 92 93 |
# File 'lib/mocha/state_machine.rb', line 91 def is_not(state_name) StatePredicate.new(self, state_name) end |
- (StateMachine) starts_as(initial_state_name)
Put the Mocha::StateMachine into the state specified by initial_state_name.
68 69 70 71 |
# File 'lib/mocha/state_machine.rb', line 68 def starts_as(initial_state_name) become(initial_state_name) self end |