aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-03-31 17:21:49 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2012-03-31 17:22:03 -0700
commit0244c0d8f339385a9b420a0565b17d327bf25b13 (patch)
treeea7c9d190bc8f6c43e7dd7071dcbd687e00d0c41 /activesupport/lib
parent67b000ebd59a9fd90abf77bd3d6f32f188b03f1f (diff)
downloadrails-0244c0d8f339385a9b420a0565b17d327bf25b13.tar.gz
rails-0244c0d8f339385a9b420a0565b17d327bf25b13.tar.bz2
rails-0244c0d8f339385a9b420a0565b17d327bf25b13.zip
use undef_method to avoid NameError exceptions all the time
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/core_ext/module/remove_method.rb6
1 files changed, 1 insertions, 5 deletions
diff --git a/activesupport/lib/active_support/core_ext/module/remove_method.rb b/activesupport/lib/active_support/core_ext/module/remove_method.rb
index b76bc16ee1..719071d1c2 100644
--- a/activesupport/lib/active_support/core_ext/module/remove_method.rb
+++ b/activesupport/lib/active_support/core_ext/module/remove_method.rb
@@ -1,12 +1,8 @@
class Module
def remove_possible_method(method)
if method_defined?(method) || private_method_defined?(method)
- remove_method(method)
+ undef_method(method)
end
- rescue NameError
- # If the requested method is defined on a superclass or included module,
- # method_defined? returns true but remove_method throws a NameError.
- # Ignore this.
end
def redefine_method(method, &block)