mirror of
https://github.com/aasm/aasm
synced 2023-03-27 23:22:41 -04:00
8e8c6baeaf
Fix #480
40 lines
798 B
Ruby
40 lines
798 B
Ruby
class RedisComplexExample
|
|
include Redis::Objects
|
|
include AASM
|
|
|
|
value :left
|
|
value :right
|
|
|
|
def id
|
|
1
|
|
end
|
|
|
|
aasm :left, :column => 'left' do
|
|
state :one, :initial => true
|
|
state :two
|
|
state :three
|
|
|
|
event :increment do
|
|
transitions :from => :one, :to => :two
|
|
transitions :from => :two, :to => :three
|
|
end
|
|
event :reset do
|
|
transitions :from => :three, :to => :one
|
|
end
|
|
end
|
|
|
|
aasm :right, :column => 'right' do
|
|
state :alpha, :initial => true
|
|
state :beta
|
|
state :gamma
|
|
|
|
event :level_up do
|
|
transitions :from => :alpha, :to => :beta
|
|
transitions :from => :beta, :to => :gamma
|
|
end
|
|
event :level_down do
|
|
transitions :from => :gamma, :to => :beta
|
|
transitions :from => :beta, :to => :alpha
|
|
end
|
|
end
|
|
end
|