Machina
a god introduced by means of a crane in ancient Greek and Roman drama to decide the final outcome
fsm = Machina.new(:unconfirmed)
fsm.when[:welcome_email] = -> { send_welcome_email }
fsm.when[:enable_account] = -> (user) { user.enabled! }
fsm[:confirm] = {
:unconfirmed => [:welcome_email, :enable_account, :confirmed],
}
fsm.on[:confirm] = -> (user) { puts "Starting confirmation process for #{user.id}." }
fsm.state # => :unconfirmed
fsm.trigger!(:confirm, user)
fsm.state # => :confirmed