instance method
redefine_method
Ruby on Rails 5.1.7
Since v3.0.20Signature
redefine_method(method, &block)
Replaces the existing method definition, if there is one, with the passed block as its body.
Parameters
-
methodreq -
blockblock
Source
# File activesupport/lib/active_support/core_ext/module/remove_method.rb, line 18
def redefine_method(method, &block)
visibility = method_visibility(method)
remove_possible_method(method)
define_method(method, &block)
send(visibility, method)
end
Defined in activesupport/lib/active_support/core_ext/module/remove_method.rb line 18
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Module