mirror of
https://github.com/aasm/aasm
synced 2023-03-27 23:22:41 -04:00
30 lines
667 B
Ruby
30 lines
667 B
Ruby
class SimpleMultipleExample
|
|
include AASM
|
|
aasm(:move) do
|
|
state :standing, :initial => true
|
|
state :walking
|
|
state :running
|
|
|
|
event :walk do
|
|
transitions :from => :standing, :to => :walking
|
|
end
|
|
event :run do
|
|
transitions :from => [:standing, :walking], :to => :running
|
|
end
|
|
event :hold do
|
|
transitions :from => [:walking, :running], :to => :standing
|
|
end
|
|
end
|
|
|
|
aasm(:work) do
|
|
state :sleeping, :initial => true
|
|
state :processing
|
|
|
|
event :start do
|
|
transitions :from => :sleeping, :to => :processing
|
|
end
|
|
event :stop do
|
|
transitions :from => :processing, :to => :sleeping
|
|
end
|
|
end
|
|
end
|