mirror of
https://github.com/aasm/aasm
synced 2023-03-27 23:22:41 -04:00
25 lines
505 B
Ruby
25 lines
505 B
Ruby
class BasicTwoStateMachinesExample
|
|
include AASM
|
|
|
|
aasm :search do
|
|
state :initialised, :initial => true
|
|
state :queried
|
|
state :requested
|
|
|
|
event :query do
|
|
transitions :from => [:initialised, :requested], :to => :queried
|
|
end
|
|
event :request do
|
|
transitions :from => :queried, :to => :requested
|
|
end
|
|
end
|
|
|
|
aasm :sync do
|
|
state :unsynced, :initial => true
|
|
state :synced
|
|
|
|
event :sync do
|
|
transitions :from => :unsynced, :to => :synced
|
|
end
|
|
end
|
|
end
|