Skip to content

Commit

Permalink
adding documentation for 'remove_possible_method' and 'redefine_metho…
Browse files Browse the repository at this point in the history
…d' [ci skip]
  • Loading branch information
george-carlin committed Jan 5, 2015
1 parent e50064c commit af211a1
Showing 1 changed file with 3 additions and 0 deletions.
@@ -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)
Expand Down

0 comments on commit af211a1

Please sign in to comment.