2015-06-26 03:46:58 -04:00
|
|
|
class FooCallbackMultiple
|
2015-05-26 05:21:04 -04:00
|
|
|
include AASM
|
2015-06-26 03:46:58 -04:00
|
|
|
|
2015-05-26 05:21:04 -04:00
|
|
|
aasm(:left) do
|
|
|
|
state :open, :initial => true, :before_exit => :before_exit
|
|
|
|
state :closed, :before_enter => :before_enter
|
|
|
|
state :final
|
|
|
|
|
|
|
|
event :close, :success => :success_callback do
|
|
|
|
transitions :from => [:open], :to => [:closed]
|
|
|
|
end
|
|
|
|
|
|
|
|
event :null do
|
|
|
|
transitions :from => [:open], :to => [:closed, :final], :guard => :always_false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-06-26 03:46:58 -04:00
|
|
|
aasm(:right, :column => :right) do
|
|
|
|
state :green, :initial => true
|
|
|
|
state :yellow
|
|
|
|
state :red
|
|
|
|
|
|
|
|
event :green do
|
|
|
|
transitions :from => [:yellow], :to => :green
|
|
|
|
end
|
|
|
|
event :yellow do
|
|
|
|
transitions :from => [:green, :red], :to => :yellow
|
|
|
|
end
|
|
|
|
event :red do
|
|
|
|
transitions :from => [:yellow], :to => :red
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-05-26 05:21:04 -04:00
|
|
|
def always_false
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
def success_callback
|
|
|
|
end
|
|
|
|
|
|
|
|
def before_enter
|
|
|
|
end
|
|
|
|
def before_exit
|
|
|
|
end
|
|
|
|
end
|