Skip to content
Browse files

use undef_method to avoid NameError exceptions all the time

  • Loading branch information...
1 parent 67b000e commit 0244c0d8f339385a9b420a0565b17d327bf25b13 @tenderlove tenderlove committed Mar 31, 2012
Showing with 1 addition and 5 deletions.
  1. +1 −5 activesupport/lib/active_support/core_ext/module/remove_method.rb
View
6 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)

0 comments on commit 0244c0d

Please sign in to comment.
Something went wrong with that request. Please try again.