state_machine

https://github.com/pluginaweek/state_machine

Ruby

Adds support for creating state machines for attributes on any Ruby class

StateMachine::ClassMethods#state_machines

Gets the current list of state machines defined for this class.  This
class-level attribute acts like an inheritable attribute.  The attribute
is available to each subclass, each having a copy of its superclass's
attribute.

The hash of state machines maps <tt>:attribute</tt> => +machine+, e.g.

  Vehicle.state_machines # => {:state => #<StateMachine::Machine:0xb6f6e4a4 ...>}

Source | Google | Stack overflow

Edit

git clone [email protected]:pluginaweek/state_machine.git

cd state_machine

open lib/state_machine/extensions.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-StateMachine--ClassMethods-state_machines-for-pr


# Commit to git

git add lib/state_machine/extensions.rbgit commit -m "better docs for StateMachine::ClassMethods#state_machines"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-StateMachine--ClassMethods-state_machines-for-pr

hub pull-request


# Celebrate!