lib/state_machine.rb in state_machine-1.0.3 vs lib/state_machine.rb in state_machine-1.1.0
- old
+ new
@@ -139,10 +139,13 @@
# names)
# * <tt>state_transitions(requirements = {})</tt> - Gets the list of
# transitions that can be made on the current object's state
# * <tt>state_paths(requirements = {})</tt> - Gets the list of sequences of
# transitions that can be run from the current object's state
+ # * <tt>fire_state_event(name, *args)</tt> - Fires an arbitrary event with
+ # the given argument list. This is essentially the same as calling the
+ # actual event method itself.
#
# The <tt>state_events</tt>, <tt>state_transitions</tt>, and <tt>state_paths</tt>
# helpers all take an optional set of requirements for determining what's
# available for the current object. These requirements include:
# * <tt>:from</tt> - One or more states to transition from. If none are
@@ -186,11 +189,11 @@
# vehicle.state_events # => [:ignite]
# vehicle.state_events(:from => :idling) # => [:park]
# vehicle.state_events(:to => :parked) # => []
#
# vehicle.state_transitions # => [#<StateMachine::Transition attribute=:state event=:ignite from="parked" from_name=:parked to="idling" to_name=:idling>]
- # vehicle.ignite
+ # vehicle.ignite # => true
# vehicle.state_transitions # => [#<StateMachine::Transition attribute=:state event=:park from="idling" from_name=:idling to="parked" to_name=:parked>]
#
# vehicle.state_transitions(:on => :ignite) # => []
#
# # Getting current path availability
@@ -200,9 +203,12 @@
# # ]
# vehicle.state_paths(:guard => false) # =>
# # [#<StateMachine::Transition attribute=:state event=:park from="idling" from_name=:idling to="parked" to_name=:parked>,
# # #<StateMachine::Transition attribute=:state event=:ignite from="parked" from_name=:parked to="idling" to_name=:idling>]
# # ]
+ #
+ # # Fire arbitrary events
+ # vehicle.fire_state_event(:park) # => true
#
# == Attribute initialization
#
# For most classes, the initial values for state machine attributes are
# automatically assigned when a new object is created. However, this