instance method silence_redefinition_of_method

Ruby on Rails 7.2.3

Since v5.2.8.1

Available in: v5.2.8.1 v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

silence_redefinition_of_method(method)

Marks the named method as intended to be redefined, if it exists. Suppresses the Ruby method redefinition warning. Prefer #redefine_method where possible.

Parameters

method req
Source
# File activesupport/lib/active_support/core_ext/module/redefine_method.rb, line 7
  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

Defined in activesupport/lib/active_support/core_ext/module/redefine_method.rb line 7 · View on GitHub · Improve this page · Find usages on GitHub

Defined in Module

Type at least 2 characters to search.

↑↓ navigate · open · esc close