2015-05-26 21:21:04 +12:00
|
|
|
module Callbacks
|
|
|
|
class WithStateArgMultiple
|
|
|
|
|
|
|
|
include AASM
|
|
|
|
|
|
|
|
aasm(:left) do
|
2015-10-06 15:01:01 +02:00
|
|
|
state :open, :initial => true
|
2015-05-26 21:21:04 +12:00
|
|
|
state :closed
|
|
|
|
state :out_to_lunch
|
|
|
|
|
|
|
|
event :close, :before => :before_method, :after => :after_method do
|
|
|
|
transitions :to => :closed, :from => [:open], :after => :transition_method
|
|
|
|
transitions :to => :out_to_lunch, :from => [:open], :after => :transition_method2
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def before_method(arg); end
|
|
|
|
|
|
|
|
def after_method(arg); end
|
|
|
|
|
|
|
|
def transition_method(arg); end
|
|
|
|
|
|
|
|
def transition_method2(arg); end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|