aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-07-03 14:18:31 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-07-03 14:18:54 -0700
commitb785e921d186753d905c1d0415b91d0987958028 (patch)
tree791ec23b87351ac1ea0ccd7607ba167168df7e0f /activesupport
parenta593fc1ee19bf365ba715f8b5e74eb6f74011eda (diff)
downloadrails-b785e921d186753d905c1d0415b91d0987958028.tar.gz
rails-b785e921d186753d905c1d0415b91d0987958028.tar.bz2
rails-b785e921d186753d905c1d0415b91d0987958028.zip
method transplanting between modules isn't supported on 1.9
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/core_ext/module/method_transplanting.rb11
1 files changed, 11 insertions, 0 deletions
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