state_machine

https://github.com/pluginaweek/state_machine

Ruby

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

StateMachine::MatcherHelpers#any

Represents a state that matches all known states in a machine.

== Examples

  class Vehicle
    state_machine do
      before_transition any => :parked, :do => lambda {...}
      before_transition all - :parked => all - :idling, :do => lambda {}
      
      event :park
        transition all => :parked
      end
      
      event :crash
        transition all - :parked => :stalled
      end
    end
  end

In the above example, +all+ will match the following states since they
are known:
* +parked+
* +stalled+
* +idling+

Source | Google | Stack overflow

Edit

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

cd state_machine

open lib/state_machine/matcher_helpers.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-StateMachine--MatcherHelpers-any-for-pr


# Commit to git

git add lib/state_machine/matcher_helpers.rbgit commit -m "better docs for StateMachine::MatcherHelpers#any"


# 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--MatcherHelpers-any-for-pr

hub pull-request


# Celebrate!