state_machine

https://github.com/pluginaweek/state_machine

Ruby

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

StateMachine::Callback#initialize

Creates a new callback that can get called based on the configured
options.

In addition to the possible configuration options for branches, the
following options can be configured:
* <tt>:bind_to_object</tt> - Whether to bind the callback to the object involved.
  If set to false, the object will be passed as a parameter instead.
  Default is integration-specific or set to the application default.
* <tt>:terminator</tt> - A block/proc that determines what callback
  results should cause the callback chain to halt (if not using the
  default <tt>throw :halt</tt> technique).

More information about how those options affect the behavior of the
callback can be found in their attribute definitions.

Source | Google | Stack overflow

Edit

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

cd state_machine

open lib/state_machine/callback.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-StateMachine--Callback-initialize-for-pr


# Commit to git

git add lib/state_machine/callback.rbgit commit -m "better docs for StateMachine::Callback#initialize"


# 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--Callback-initialize-for-pr

hub pull-request


# Celebrate!