state_machine
https://github.com/pluginaweek/state_machine
Ruby
Adds support for creating state machines for attributes on any Ruby class
StateMachine::State#description
Generates a human-readable description of this state's name / value:
For example,
State.new(machine, :parked).description # => "parked"
State.new(machine, :parked, :value => :parked).description # => "parked"
State.new(machine, :parked, :value => nil).description # => "parked (nil)"
State.new(machine, :parked, :value => 1).description # => "parked (1)"
State.new(machine, :parked, :value => lambda {Time.now}).description # => "parked (*)
Configuration options:
* <tt>:human_name</tt> - Whether to use this state's human name in the
description or just the internal 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-description-for-pr
# Commit to gitgit add lib/state_machine/state.rbgit commit -m "better docs for StateMachine::State#description"
# 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-description-for-pr
hub pull-request
# Celebrate!