From b785e921d186753d905c1d0415b91d0987958028 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 3 Jul 2013 14:18:31 -0700 Subject: method transplanting between modules isn't supported on 1.9 --- .../active_support/core_ext/module/method_transplanting.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 activesupport/lib/active_support/core_ext/module/method_transplanting.rb (limited to 'activesupport/lib/active_support') diff --git a/activesupport/lib/active_support/core_ext/module/method_transplanting.rb b/activesupport/lib/active_support/core_ext/module/method_transplanting.rb new file mode 100644 index 0000000000..b1097cc83b --- /dev/null +++ b/activesupport/lib/active_support/core_ext/module/method_transplanting.rb @@ -0,0 +1,11 @@ +class Module + ### + # TODO: remove this after 1.9 support is dropped + def methods_transplantable? # :nodoc: + x = Module.new { def foo; end } + Module.new { define_method :bar, x.instance_method(:foo) } + true + rescue TypeError + false + end +end -- cgit v1.2.3