Class: Car
State Machines
This class contains 1 state machine(s).state

Instance Attribute Summary
Attributes inherited from Vehicle
Instance Method Summary (collapse)
-
- (Boolean) backing_up?
Checks whether :backing_up is the current state.
-
- (Boolean) can_reverse?(requirements = {})
Checks whether :reverse can be fired.
-
- (Boolean) reverse(*args)
Fires the :reverse event.
-
- (Boolean) reverse!(*args)
Fires the :reverse event, raising an exception if it fails.
-
- (StateMachine::Transition) reverse_transition(requirements = {})
Gets the next transition that would be performed if :reverse were to be fired.
Methods inherited from Vehicle
#can_crash?, #can_idle?, #can_ignite?, #can_park?, #can_repair?, #can_shift_down?, #can_shift_up?, #crash, #crash!, #crash_transition, #fire_state_event, #first_gear?, human_state_event_name, human_state_name, #human_state_name, #idle, #idle!, #idle_transition, #idling?, #ignite, #ignite!, #ignite_transition, #park, #park!, #park_transition, #parked?, #repair, #repair!, #repair_transition, #second_gear?, #shift_down, #shift_down!, #shift_down_transition, #shift_up, #shift_up!, #shift_up_transition, #stalled?, #state?, #state_events, #state_name, #state_paths, #state_transitions, #third_gear?
Instance Method Details
- (Boolean) backing_up?
Checks whether :backing_up is the current state.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'car.rb', line 4 state_machine do event :reverse do transition [:parked, :idling, :first_gear] => :backing_up end event :park do transition :backing_up => :parked end event :idle do transition :backing_up => :idling end event :shift_up do transition :backing_up => :first_gear end end |
- (Boolean) can_reverse?(requirements = {})
Checks whether :reverse can be fired.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'car.rb', line 4 state_machine do event :reverse do transition [:parked, :idling, :first_gear] => :backing_up end event :park do transition :backing_up => :parked end event :idle do transition :backing_up => :idling end event :shift_up do transition :backing_up => :first_gear end end |
- (Boolean) reverse(*args)
Fires the :reverse event.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'car.rb', line 4 state_machine do event :reverse do transition [:parked, :idling, :first_gear] => :backing_up end event :park do transition :backing_up => :parked end event :idle do transition :backing_up => :idling end event :shift_up do transition :backing_up => :first_gear end end |
- (Boolean) reverse!(*args)
Fires the :reverse event, raising an exception if it fails.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'car.rb', line 4 state_machine do event :reverse do transition [:parked, :idling, :first_gear] => :backing_up end event :park do transition :backing_up => :parked end event :idle do transition :backing_up => :idling end event :shift_up do transition :backing_up => :first_gear end end |
- (StateMachine::Transition) reverse_transition(requirements = {})
Gets the next transition that would be performed if :reverse were to be fired.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'car.rb', line 4 state_machine do event :reverse do transition [:parked, :idling, :first_gear] => :backing_up end event :park do transition :backing_up => :parked end event :idle do transition :backing_up => :idling end event :shift_up do transition :backing_up => :first_gear end end |