mirror of
https://github.com/aasm/aasm
synced 2023-03-27 23:22:41 -04:00
35 lines
547 B
Ruby
35 lines
547 B
Ruby
class Foo
|
|
include AASM
|
|
aasm do
|
|
state :open, :initial => true, :exit => :exit
|
|
state :closed, :enter => :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
|
|
|
|
def always_false
|
|
false
|
|
end
|
|
|
|
def success_callback
|
|
end
|
|
|
|
def enter
|
|
end
|
|
def exit
|
|
end
|
|
end
|
|
|
|
class FooTwo < Foo
|
|
include AASM
|
|
aasm do
|
|
state :foo
|
|
end
|
|
end
|