state_machine
https://github.com/pluginaweek/state_machine
Ruby
Adds support for creating state machines for attributes on any Ruby class
StateMachine::Integrations::Base::ClassMethods#version
Creates a new version override for an integration. When this
integration is activated, each version that is marked as active will
also extend the integration.
== Example
module StateMachine
module Integrations
module ORMLibrary
version '0.2.x - 0.3.x' do
def self.active?
::ORMLibrary::VERSION >= '0.2.0' && ::ORMLibrary::VERSION < '0.4.0'
end
def invalidate(object, attribute, message, values = [])
# Override here...
end
end
end
end
end
In the above example, a version override is defined for the ORMLibrary
integration when the version is between 0.2.x and 0.3.x.Edit
git clone [email protected]:pluginaweek/state_machine.git
cd state_machine
open lib/state_machine/integrations/base.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-StateMachine--Integrations--Base--ClassMethods-version-for-pr
# Commit to gitgit add lib/state_machine/integrations/base.rbgit commit -m "better docs for StateMachine::Integrations::Base::ClassMethods#version"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-StateMachine--Integrations--Base--ClassMethods-version-for-pr
hub pull-request
# Celebrate!