class Module

def silence_redefinition_of_method(method)

#redefine_method where possible.
Suppresses the Ruby method redefinition warning. Prefer
Marks the named method as intended to be redefined, if it exists.
def silence_redefinition_of_method(method)
  if method_defined?(method) || private_method_defined?(method)
    # This suppresses the "method redefined" warning; the self-alias
    # looks odd, but means we don't need to generate a unique name
    alias_method method, method
  end
end