diff options
author | George Millo <georgejulianmillo@gmail.com> | 2015-01-05 23:47:32 +0000 |
---|---|---|
committer | George Millo <georgejulianmillo@gmail.com> | 2015-01-05 23:47:32 +0000 |
commit | af211a1e079bd937bdde9413df7042a5267feb38 (patch) | |
tree | fa86102c66f672b51d6c0d0ebcd8f5866977bb86 /activesupport/lib | |
parent | e50064c130f8b6465a78928e38588196515ccf27 (diff) | |
download | rails-af211a1e079bd937bdde9413df7042a5267feb38.tar.gz rails-af211a1e079bd937bdde9413df7042a5267feb38.tar.bz2 rails-af211a1e079bd937bdde9413df7042a5267feb38.zip |
adding documentation for 'remove_possible_method' and 'redefine_method' [ci skip]
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/core_ext/module/remove_method.rb | 3 |
1 files changed, 3 insertions, 0 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 719071d1c2..8a2569a7d0 100644 --- a/activesupport/lib/active_support/core_ext/module/remove_method.rb +++ b/activesupport/lib/active_support/core_ext/module/remove_method.rb @@ -1,10 +1,13 @@ class Module + # Remove the named method, if it exists. def remove_possible_method(method) if method_defined?(method) || private_method_defined?(method) undef_method(method) end end + # Replace the existing method definition, if there is one, with the contents + # of the block. def redefine_method(method, &block) remove_possible_method(method) define_method(method, &block) |