2015-05-15 07:09:25 -04:00
|
|
|
class SuperClass
|
2013-04-21 12:43:03 -04:00
|
|
|
include AASM
|
|
|
|
|
|
|
|
aasm do
|
|
|
|
state :read
|
|
|
|
state :ended
|
|
|
|
|
|
|
|
event :foo do
|
|
|
|
transitions :to => :ended, :from => [:read]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-05-15 07:09:25 -04:00
|
|
|
def update_state
|
|
|
|
if may_foo?
|
|
|
|
foo!
|
|
|
|
end
|
|
|
|
end
|
2013-04-21 12:43:03 -04:00
|
|
|
end
|
2015-07-01 05:35:04 -04:00
|
|
|
|
|
|
|
class SuperClassMultiple
|
|
|
|
include AASM
|
|
|
|
|
|
|
|
aasm(:left) do
|
|
|
|
state :read
|
|
|
|
state :ended
|
|
|
|
|
|
|
|
event :foo do
|
|
|
|
transitions :to => :ended, :from => [:read]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
aasm(:right) do
|
|
|
|
state :opened
|
|
|
|
state :closed
|
|
|
|
|
|
|
|
event :close do
|
|
|
|
transitions :to => :closed, :from => [:opened]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def update_state
|
|
|
|
if may_foo?
|
|
|
|
foo!
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|