Method: Module#redefine_method

Defined in:
activesupport/lib/active_support/core_ext/module/redefine_method.rb

#redefine_method(method, &block) ⇒ Object

Replaces the existing method definition, if there is one, with the passed block as its body.



17
18
19
20
21
22
# File 'activesupport/lib/active_support/core_ext/module/redefine_method.rb', line 17

def redefine_method(method, &block)
  visibility = method_visibility(method)
  silence_redefinition_of_method(method)
  define_method(method, &block)
  send(visibility, method)
end