diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2015-01-05 17:14:14 -0700 |
---|---|---|
committer | Sean Griffin <sean@seantheprogrammer.com> | 2015-01-05 17:14:14 -0700 |
commit | c24e9c9be4c388dbc4fbebb06092a91ff79eafab (patch) | |
tree | 5dbb06ef2a6784daedac06f1741c2b977bef861b /activesupport/lib | |
parent | 1ab7eba89b93135940bd4ec4d799e62cecbfd2ba (diff) | |
parent | af211a1e079bd937bdde9413df7042a5267feb38 (diff) | |
download | rails-c24e9c9be4c388dbc4fbebb06092a91ff79eafab.tar.gz rails-c24e9c9be4c388dbc4fbebb06092a91ff79eafab.tar.bz2 rails-c24e9c9be4c388dbc4fbebb06092a91ff79eafab.zip |
Merge pull request #18355 from georgemillo/docs
Documenting '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) |