From af211a1e079bd937bdde9413df7042a5267feb38 Mon Sep 17 00:00:00 2001 From: George Millo Date: Mon, 5 Jan 2015 23:47:32 +0000 Subject: adding documentation for 'remove_possible_method' and 'redefine_method' [ci skip] --- activesupport/lib/active_support/core_ext/module/remove_method.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'activesupport/lib') 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) -- cgit v1.2.3