Skip to content
Browse files

AS::Callbacks.__run_keyed_callback: remove unused cache

  • Loading branch information...
1 parent 80f96eb commit 08cc49b919cfa43a19f55b761dba56bc3673b6b7 @bogdan bogdan committed
Showing with 6 additions and 10 deletions.
  1. +6 −10 activesupport/lib/active_support/callbacks.rb
View
16 activesupport/lib/active_support/callbacks.rb
@@ -394,16 +394,12 @@ def #{runner_method}(key = nil, &blk)
#
def __run_keyed_callback(key, kind, object, &blk) #:nodoc:
name = "_run__#{self.name.hash.abs}__#{kind}__#{key.hash.abs}__callbacks"
- unless respond_to?(name)
- @_keyed_callbacks ||= {}
- @_keyed_callbacks[name] ||= begin
- str = send("_#{kind}_callbacks").compile(name, object)
- class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
- def #{name}() #{str} end
- protected :#{name}
- RUBY_EVAL
- true
- end
+ unless object.respond_to?(name)
+ str = send("_#{kind}_callbacks").compile(name, object)
+ class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
+ def #{name}() #{str} end
+ protected :#{name}
+ RUBY_EVAL
end
object.send(name, &blk)
end

0 comments on commit 08cc49b

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