1
0
Fork 0
mirror of https://github.com/aasm/aasm synced 2023-03-27 23:22:41 -04:00

move .events to .aasm_events

This commit is contained in:
Scott Barron 2008-01-08 10:03:18 -05:00
parent 7aae9e432d
commit 342984a3eb

View file

@ -27,17 +27,16 @@ module AASM
def event(name, &block) def event(name, &block)
define_method("#{name.to_s}!") do define_method("#{name.to_s}!") do
new_state = self.class.events[name].fire(self) new_state = self.class.aasm_events[name].fire(self)
self.aasm_current_state = new_state self.aasm_current_state = new_state
nil nil
end end
events[name] = AASM::SupportingClasses::Event.new(name, &block) aasm_events[name] = AASM::SupportingClasses::Event.new(name, &block)
# Error if event defines no transitions? # Error if event defines no transitions?
end end
private def aasm_events
def events
@aasm_events ||= {} @aasm_events ||= {}
end end
end end