aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/new_callbacks.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/new_callbacks.rb')
-rw-r--r--activesupport/lib/active_support/new_callbacks.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/new_callbacks.rb b/activesupport/lib/active_support/new_callbacks.rb
index 039d0fa658..b6cbdbb6b0 100644
--- a/activesupport/lib/active_support/new_callbacks.rb
+++ b/activesupport/lib/active_support/new_callbacks.rb
@@ -287,6 +287,14 @@ module ActiveSupport
when Proc
@klass.send(:define_method, method_name, &filter)
method_name << (filter.arity == 1 ? "(self)" : "")
+ when Method
+ @klass.send(:define_method, "#{method_name}_method") { filter }
+ @klass.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
+ def #{method_name}(&blk)
+ #{method_name}_method.call(self, &blk)
+ end
+ RUBY_EVAL
+ method_name
when String
@klass.class_eval <<-RUBY_EVAL
def #{method_name}