mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
AS::Callbacks: improved __define_runner performance
This commit is contained in:
parent
748725e9ce
commit
7e75dc5d86
1 changed files with 2 additions and 3 deletions
|
@ -381,9 +381,8 @@ module ActiveSupport
|
||||||
name = __callback_runner_name(nil, symbol)
|
name = __callback_runner_name(nil, symbol)
|
||||||
undef_method(name) if method_defined?(name)
|
undef_method(name) if method_defined?(name)
|
||||||
|
|
||||||
silence_warnings do
|
runner_method = "_run_#{symbol}_callbacks"
|
||||||
runner_method = "_run_#{symbol}_callbacks"
|
unless private_method_defined?(runner_method)
|
||||||
undef_method runner_method if method_defined?(runner_method)
|
|
||||||
class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
|
class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
|
||||||
def #{runner_method}(key = nil, &blk)
|
def #{runner_method}(key = nil, &blk)
|
||||||
self.class.__run_callback(key, :#{symbol}, self, &blk)
|
self.class.__run_callback(key, :#{symbol}, self, &blk)
|
||||||
|
|
Loading…
Reference in a new issue