state_machine
https://github.com/pluginaweek/state_machine
Ruby
Adds support for creating state machines for attributes on any Ruby class
StateMachine::State#initialize
Creates a new state within the context of the given machine.
Configuration options:
* <tt>:initial</tt> - Whether this state is the beginning state for the
machine. Default is false.
* <tt>:value</tt> - The value to store when an object transitions to this
state. Default is the name (stringified).
* <tt>:cache</tt> - If a dynamic value (via a lambda block) is being used,
then setting this to true will cache the evaluated result
* <tt>:if</tt> - Determines whether a value matches this state
(e.g. :value => lambda {Time.now}, :if => lambda {|state| !state.nil?}).
By default, the configured value is matched.
* <tt>:human_name</tt> - The human-readable version of this state's nameEdit
git clone [email protected]:pluginaweek/state_machine.git
cd state_machine
open lib/state_machine/state.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-StateMachine--State-initialize-for-pr
# Commit to gitgit add lib/state_machine/state.rbgit commit -m "better docs for StateMachine::State#initialize"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-StateMachine--State-initialize-for-pr
hub pull-request
# Celebrate!