1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

AS::Callbacks.__run_keyed_callback: remove unused cache

This commit is contained in:
Bogdan Gusiev 2011-11-10 16:42:27 +02:00
parent 80f96ebcf5
commit 08cc49b919

View file

@ -394,16 +394,12 @@ module ActiveSupport
# #
def __run_keyed_callback(key, kind, object, &blk) #:nodoc: def __run_keyed_callback(key, kind, object, &blk) #:nodoc:
name = "_run__#{self.name.hash.abs}__#{kind}__#{key.hash.abs}__callbacks" name = "_run__#{self.name.hash.abs}__#{kind}__#{key.hash.abs}__callbacks"
unless respond_to?(name) unless object.respond_to?(name)
@_keyed_callbacks ||= {} str = send("_#{kind}_callbacks").compile(name, object)
@_keyed_callbacks[name] ||= begin class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
str = send("_#{kind}_callbacks").compile(name, object) def #{name}() #{str} end
class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1 protected :#{name}
def #{name}() #{str} end RUBY_EVAL
protected :#{name}
RUBY_EVAL
true
end
end end
object.send(name, &blk) object.send(name, &blk)
end end