2011-11-26 20:49:46 +01:00
|
|
|
class Silencer
|
|
|
|
include AASM
|
|
|
|
|
2015-12-08 22:55:44 +13:00
|
|
|
# yes, this line is here on purpose
|
|
|
|
# by this, we test if overriding configuration options works if
|
|
|
|
# the state machine is "re-opened"
|
|
|
|
aasm :whiny_transitions => true
|
|
|
|
|
2011-11-26 20:49:46 +01:00
|
|
|
aasm :whiny_transitions => false do
|
|
|
|
state :silent, :initial => true
|
|
|
|
state :crying
|
|
|
|
state :smiling
|
|
|
|
|
|
|
|
event :cry do
|
|
|
|
transitions :from => :silent, :to => :crying
|
|
|
|
end
|
2012-10-18 23:18:03 -07:00
|
|
|
|
2011-11-26 20:49:46 +01:00
|
|
|
event :smile do
|
|
|
|
transitions :from => :crying, :to => :smiling
|
|
|
|
end
|
2012-10-18 23:18:03 -07:00
|
|
|
|
|
|
|
event :smile_any do
|
|
|
|
transitions :to => :smiling
|
|
|
|
end
|
2011-11-26 20:49:46 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|