module ActiveSupport::Deprecation::Behavior

def arity_coerce(behavior)

def arity_coerce(behavior)
  unless behavior.respond_to?(:call)
    raise ArgumentError, "#{behavior.inspect} is not a valid deprecation behavior."
  end
  if behavior.respond_to?(:arity) && behavior.arity == 2
    -> message, callstack, _, _ { behavior.call(message, callstack) }
  else
    behavior
  end
end

def behavior

Returns the current behavior or if one isn't set, defaults to +:stderr+.
def behavior
  @behavior ||= [DEFAULT_BEHAVIORS[:stderr]]
end

def behavior=(behavior)

all deprecation behaviors. This is similar to the +silence+ option but more performant.
If you are using Rails, you can set config.active_support.report_deprecations = false to disable

}
# custom stuff
ActiveSupport::Deprecation.behavior = ->(message, callstack, deprecation_horizon, gem_name) {
ActiveSupport::Deprecation.behavior = MyCustomHandler
ActiveSupport::Deprecation.behavior = [:stderr, :log]
ActiveSupport::Deprecation.behavior = :stderr

because they happen before Rails boots up.
Deprecation warnings raised by gems are not affected by this setting
Setting behaviors only affects deprecations that happen after boot time.

[+silence+] Do nothing.
[+notify+] Use +ActiveSupport::Notifications+ to notify +deprecation.rails+.
[+log+] Log all deprecation warnings to +Rails.logger+.
[+stderr+] Log all deprecation warnings to $stderr.
[+raise+] Raise ActiveSupport::DeprecationException.

Available behaviors:

or an object that responds to +call+.
Sets the behavior to the specified value. Can be a single value, array,
def behavior=(behavior)
  @behavior = Array(behavior).map { |b| DEFAULT_BEHAVIORS[b] || arity_coerce(b) }
end

def disallowed_behavior

Returns the current behavior for disallowed deprecations or if one isn't set, defaults to +:raise+.
def disallowed_behavior
  @disallowed_behavior ||= [DEFAULT_BEHAVIORS[:raise]]
end

def disallowed_behavior=(behavior)

object that responds to +call+.
value. As with +behavior=+, this can be a single value, array, or an
ActiveSupport::Deprecation.disallowed_warnings=) to the specified
Sets the behavior for disallowed deprecations (those configured by
def disallowed_behavior=(behavior)
  @disallowed_behavior = Array(behavior).map { |b| DEFAULT_BEHAVIORS[b] || arity_coerce(b) }
end