diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-08-05 14:52:07 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-08-05 14:52:07 -0300 |
commit | ae175a5354321fd64393b9e1f4080437ee3cdf74 (patch) | |
tree | 43a858b6f5c88ff418c97274f34abe833ff490ce /activemodel/lib/active_model/state_machine/machine.rb | |
parent | f8eb4434d61fc1585c9b88dbb2d9159ea1f5b2fa (diff) | |
parent | cfd421daa2b04216e27d666361eb4053020e027d (diff) | |
download | rails-ae175a5354321fd64393b9e1f4080437ee3cdf74.tar.gz rails-ae175a5354321fd64393b9e1f4080437ee3cdf74.tar.bz2 rails-ae175a5354321fd64393b9e1f4080437ee3cdf74.zip |
Merge commit 'rails/master'
Diffstat (limited to 'activemodel/lib/active_model/state_machine/machine.rb')
-rw-r--r-- | activemodel/lib/active_model/state_machine/machine.rb | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/activemodel/lib/active_model/state_machine/machine.rb b/activemodel/lib/active_model/state_machine/machine.rb index a5ede021b1..777531213e 100644 --- a/activemodel/lib/active_model/state_machine/machine.rb +++ b/activemodel/lib/active_model/state_machine/machine.rb @@ -1,6 +1,3 @@ -require 'active_model/state_machine/state' -require 'active_model/state_machine/event' - module ActiveModel module StateMachine class Machine @@ -57,22 +54,22 @@ module ActiveModel "@#{@name}_current_state" end - private - def state(name, options = {}) - @states << (state_index[name] ||= State.new(name, :machine => self)).update(options) - end + private + def state(name, options = {}) + @states << (state_index[name] ||= State.new(name, :machine => self)).update(options) + end - def event(name, options = {}, &block) - (@events[name] ||= Event.new(self, name)).update(options, &block) - end + def event(name, options = {}, &block) + (@events[name] ||= Event.new(self, name)).update(options, &block) + end - def event_fired_callback - @event_fired_callback ||= (@name == :default ? '' : "#{@name}_") + 'event_fired' - end + def event_fired_callback + @event_fired_callback ||= (@name == :default ? '' : "#{@name}_") + 'event_fired' + end - def event_failed_callback - @event_failed_callback ||= (@name == :default ? '' : "#{@name}_") + 'event_failed' - end + def event_failed_callback + @event_failed_callback ||= (@name == :default ? '' : "#{@name}_") + 'event_failed' + end end end end |