Skip to content
Browse files

Some performance goodness for AM StateMatchine.

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
  • Loading branch information...
1 parent 948ed34 commit b42f53ca1fa0af0fd9cc37e2765cd9c47b100065 @clemens clemens committed with jeremy Sep 2, 2008
Showing with 3 additions and 3 deletions.
  1. +3 −3 activemodel/lib/active_model/state_machine/event.rb
View
6 activemodel/lib/active_model/state_machine/event.rb
@@ -2,15 +2,15 @@ module ActiveModel
module StateMachine
class Event
attr_reader :name, :success
-
+
def initialize(machine, name, options = {}, &block)
@machine, @name, @transitions = machine, name, []
if machine
- machine.klass.send(:define_method, "#{name.to_s}!") do |*args|
+ machine.klass.send(:define_method, "#{name}!") do |*args|
machine.fire_event(name, self, true, *args)
end
- machine.klass.send(:define_method, "#{name.to_s}") do |*args|
+ machine.klass.send(:define_method, name.to_s) do |*args|
machine.fire_event(name, self, false, *args)
end
end

0 comments on commit b42f53c

Please sign in to comment.
Something went wrong with that request. Please try again.