ActiveSupport::Deprecation

Deprecation specifies the API used by Rails to deprecate methods, instance variables, objects and constants.

Namespace
Methods
N
Included Modules
Constants
DEFAULT_BEHAVIORS = { raise: ->(message, callstack) { e = DeprecationException.new(message) e.set_backtrace(callstack.map(&:to_s)) raise e }, stderr: ->(message, callstack) { $stderr.puts(message) $stderr.puts callstack.join("\n ") if debug }, log: ->(message, callstack) { logger = if defined?(Rails.logger) && Rails.logger Rails.logger else require "active_support/logger" ActiveSupport::Logger.new($stderr) end logger.warn message logger.debug callstack.join("\n ") if debug }, notify: ->(message, callstack) { ActiveSupport::Notifications.instrument("deprecation.rails", message: message, callstack: callstack) }, silence: ->(message, callstack) {}, }
 

Default warning behaviors per Rails.env.

Attributes
[RW] deprecation_horizon

The version number in which the deprecated behavior will be removed, by default.

Class Public methods
new(deprecation_horizon = "5.2", gem_name = "Rails")

It accepts two parameters on initialization. The first is a version of library and the second is a library name

ActiveSupport::Deprecation.new('2.0', 'MyLibrary')
# File activesupport/lib/active_support/deprecation.rb, line 36
def initialize(deprecation_horizon = "5.2", gem_name = "Rails")
  self.gem_name = gem_name
  self.deprecation_horizon = deprecation_horizon
  # By default, warnings are not silenced and debugging is off.
  self.silenced = false
  self.debug = false
end