2011-09-16 10:57:23 -04:00
|
|
|
class Foo
|
|
|
|
include AASM
|
2011-11-26 15:11:57 -05:00
|
|
|
aasm do
|
|
|
|
state :open, :initial => true, :exit => :exit
|
|
|
|
state :closed, :enter => :enter
|
2011-09-16 10:57:23 -04:00
|
|
|
|
2011-11-26 15:11:57 -05:00
|
|
|
event :close, :success => :success_callback do
|
2013-04-28 11:46:16 -04:00
|
|
|
transitions :from => [:open], :to => [:closed]
|
2011-11-26 15:11:57 -05:00
|
|
|
end
|
2011-09-16 10:57:23 -04:00
|
|
|
|
2011-11-26 15:11:57 -05:00
|
|
|
event :null do
|
2013-04-28 11:46:16 -04:00
|
|
|
transitions :from => [:open], :to => :closed, :guard => :always_false
|
2011-11-26 15:11:57 -05:00
|
|
|
end
|
2011-09-16 10:57:23 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def always_false
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
def success_callback
|
|
|
|
end
|
|
|
|
|
|
|
|
def enter
|
|
|
|
end
|
|
|
|
def exit
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class FooTwo < Foo
|
|
|
|
include AASM
|
2011-11-26 15:11:57 -05:00
|
|
|
aasm do
|
|
|
|
state :foo
|
|
|
|
end
|
2011-09-16 10:57:23 -04:00
|
|
|
end
|