State_attr is a project mainly written in Ruby, it's free.
Minimalistic state machine approach allowing multiple state attributes at the same time.
StateAttr is an minimalistic state machine approach for rails allowing multiple state attributes at the same time.
gem install state_attr
state_attr :state, {
nil => :first,
:first => [:second, :third],
:second => :last,
:third => nil,
}
state_attr :special_state, {
nil => :first,
:first => :special,
:second => :special,
:third => nil,
}, :groups => {
:special => %w(second third)
}
state_attr :invitation_state, {
:invited => %w{approved rejected},
:approved => :rejected,
:rejected => :approved,
}, :initial => :invited
state_attr :progress, {
nil => :one,
:one => :two,
:two => :three
} do |old, new|
if new == :three
send_mail "You just finished."
else
send_mail "You just made to #{new}."
end
true #if false then state will be not set
end
value
(not yet implemented)state=