From 0244c0d8f339385a9b420a0565b17d327bf25b13 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Sat, 31 Mar 2012 17:21:49 -0700 Subject: use undef_method to avoid NameError exceptions all the time --- activesupport/lib/active_support/core_ext/module/remove_method.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'activesupport/lib/active_support') 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) -- cgit v1.2.3