mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
update AS/deprecation docs [ci skip]
This commit is contained in:
parent
f210a369d1
commit
8673c2eefb
2 changed files with 9 additions and 9 deletions
|
@ -6,13 +6,13 @@ module ActiveSupport
|
||||||
# Whether to print a backtrace along with the warning.
|
# Whether to print a backtrace along with the warning.
|
||||||
attr_accessor :debug
|
attr_accessor :debug
|
||||||
|
|
||||||
# Returns the current behavior or if one isn't set, defaults to +:stderr+
|
# Returns the current behavior or if one isn't set, defaults to +:stderr+.
|
||||||
def behavior
|
def behavior
|
||||||
@behavior ||= [DEFAULT_BEHAVIORS[:stderr]]
|
@behavior ||= [DEFAULT_BEHAVIORS[:stderr]]
|
||||||
end
|
end
|
||||||
|
|
||||||
# Sets the behavior to the specified value. Can be a single value, array, or
|
# Sets the behavior to the specified value. Can be a single value, array,
|
||||||
# an object that responds to +call+.
|
# or an object that responds to +call+.
|
||||||
#
|
#
|
||||||
# Available behaviors:
|
# Available behaviors:
|
||||||
#
|
#
|
||||||
|
@ -22,13 +22,13 @@ module ActiveSupport
|
||||||
# [+silence+] Do nothing.
|
# [+silence+] Do nothing.
|
||||||
#
|
#
|
||||||
# Setting behaviors only affects deprecations that happen after boot time.
|
# Setting behaviors only affects deprecations that happen after boot time.
|
||||||
# Deprecation warnings raised by gems are not affected by this setting because
|
# Deprecation warnings raised by gems are not affected by this setting
|
||||||
# they happen before Rails boots up.
|
# because they happen before Rails boots up.
|
||||||
#
|
#
|
||||||
# ActiveSupport::Deprecation.behavior = :stderr
|
# ActiveSupport::Deprecation.behavior = :stderr
|
||||||
# ActiveSupport::Deprecation.behavior = [:stderr, :log]
|
# ActiveSupport::Deprecation.behavior = [:stderr, :log]
|
||||||
# ActiveSupport::Deprecation.behavior = MyCustomHandler
|
# ActiveSupport::Deprecation.behavior = MyCustomHandler
|
||||||
# ActiveSupport::Deprecation.behavior = proc { |message, callstack|
|
# ActiveSupport::Deprecation.behavior = proc { |message, callstack|
|
||||||
# # custom stuff
|
# # custom stuff
|
||||||
# }
|
# }
|
||||||
def behavior=(behavior)
|
def behavior=(behavior)
|
||||||
|
|
|
@ -6,7 +6,7 @@ module ActiveSupport
|
||||||
# Outputs a deprecation warning to the output configured by
|
# Outputs a deprecation warning to the output configured by
|
||||||
# <tt>ActiveSupport::Deprecation.behavior</tt>.
|
# <tt>ActiveSupport::Deprecation.behavior</tt>.
|
||||||
#
|
#
|
||||||
# ActiveSupport::Deprecation.warn("something broke!")
|
# ActiveSupport::Deprecation.warn('something broke!')
|
||||||
# # => "DEPRECATION WARNING: something broke! (called from your_code.rb:1)"
|
# # => "DEPRECATION WARNING: something broke! (called from your_code.rb:1)"
|
||||||
def warn(message = nil, callstack = caller)
|
def warn(message = nil, callstack = caller)
|
||||||
return if silenced
|
return if silenced
|
||||||
|
@ -17,11 +17,11 @@ module ActiveSupport
|
||||||
|
|
||||||
# Silence deprecation warnings within the block.
|
# Silence deprecation warnings within the block.
|
||||||
#
|
#
|
||||||
# ActiveSupport::Deprecation.warn("something broke!")
|
# ActiveSupport::Deprecation.warn('something broke!')
|
||||||
# # => "DEPRECATION WARNING: something broke! (called from your_code.rb:1)"
|
# # => "DEPRECATION WARNING: something broke! (called from your_code.rb:1)"
|
||||||
#
|
#
|
||||||
# ActiveSupport::Deprecation.silence do
|
# ActiveSupport::Deprecation.silence do
|
||||||
# ActiveSupport::Deprecation.warn("something broke!")
|
# ActiveSupport::Deprecation.warn('something broke!')
|
||||||
# end
|
# end
|
||||||
# # => nil
|
# # => nil
|
||||||
def silence
|
def silence
|
||||||
|
|
Loading…
Reference in a new issue