Class: ActiveSupport::Deprecation
- Includes:
- Behavior, InstanceDelegator, MethodWrapper, Reporting, Singleton
- Defined in:
- activesupport/lib/active_support/deprecation.rb,
activesupport/lib/active_support/deprecation/reporting.rb,
activesupport/lib/active_support/deprecation/behaviors.rb,
activesupport/lib/active_support/deprecation/proxy_wrappers.rb,
activesupport/lib/active_support/deprecation/method_wrappers.rb,
activesupport/lib/active_support/deprecation/instance_delegator.rb
Overview
Deprecation specifies the API used by Rails to deprecate methods, instance variables, objects and constants.
Defined Under Namespace
Modules: Behavior, InstanceDelegator, MethodWrapper, Reporting Classes: DeprecatedConstantProxy, DeprecatedInstanceVariableProxy, DeprecatedObjectProxy, DeprecationProxy
Constant Summary collapse
- DEFAULT_BEHAVIORS =
Default warning behaviors per Rails.env.
{ :stderr => Proc.new { |, callstack| $stderr.puts() $stderr.puts callstack.join("\n ") if debug }, :log => Proc.new { |, callstack| logger = if defined?(Rails) && Rails.logger Rails.logger else require 'active_support/logger' ActiveSupport::Logger.new($stderr) end logger.warn logger.debug callstack.join("\n ") if debug }, :notify => Proc.new { |, callstack| ActiveSupport::Notifications.instrument("deprecation.rails", :message => , :callstack => callstack) }, :silence => Proc.new { |, callstack| } }
Instance Attribute Summary collapse
-
#deprecation_horizon ⇒ Object
The version number in which the deprecated behavior will be removed, by default.
Attributes included from Reporting
Attributes included from Behavior
Instance Method Summary collapse
-
#initialize(deprecation_horizon = '4.1', gem_name = 'Rails') ⇒ Deprecation
constructor
It accepts two parameters on initialization.
Methods included from MethodWrapper
Methods included from Reporting
#deprecation_warning, #silence, #warn
Methods included from Behavior
Methods included from InstanceDelegator
Constructor Details
#initialize(deprecation_horizon = '4.1', gem_name = 'Rails') ⇒ Deprecation
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')
35 36 37 38 39 40 41 |
# File 'activesupport/lib/active_support/deprecation.rb', line 35 def initialize(deprecation_horizon = '4.1', 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 |
Instance Attribute Details
#deprecation_horizon ⇒ Object
The version number in which the deprecated behavior will be removed, by default.
29 30 31 |
# File 'activesupport/lib/active_support/deprecation.rb', line 29 def deprecation_horizon @deprecation_horizon end |