2011-11-26 14:49:46 -05:00
|
|
|
class Silencer
|
|
|
|
include AASM
|
|
|
|
|
2015-12-08 04:55:44 -05: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 14:49:46 -05: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-19 02:18:03 -04:00
|
|
|
|
2011-11-26 14:49:46 -05:00
|
|
|
event :smile do
|
|
|
|
transitions :from => :crying, :to => :smiling
|
|
|
|
end
|
2012-10-19 02:18:03 -04:00
|
|
|
|
|
|
|
event :smile_any do
|
|
|
|
transitions :to => :smiling
|
|
|
|
end
|
2011-11-26 14:49:46 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|