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 name

Source | Google | Stack overflow

Edit

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

cd state_machine

open lib/state_machine/state.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-StateMachine--State-description-for-pr


# Commit to git

git add lib/state_machine/state.rbgit commit -m "better docs for StateMachine::State#description"


# 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--State-description-for-pr

hub pull-request


# Celebrate!