aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-06-17 12:31:40 -0500
committerFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-06-17 12:31:40 -0500
commit508538066c54b88bd2cca243ceaf5b65c0bee4ec (patch)
tree19730b6bfdfdde05da0a43ee7e322938a37b91bd
parenta7a4e91577e832e9bf902bdb704e87de9a42d56e (diff)
downloadrails-508538066c54b88bd2cca243ceaf5b65c0bee4ec.tar.gz
rails-508538066c54b88bd2cca243ceaf5b65c0bee4ec.tar.bz2
rails-508538066c54b88bd2cca243ceaf5b65c0bee4ec.zip
add example to AS::Deprecation#silence [ci skip]
-rw-r--r--activesupport/lib/active_support/deprecation/reporting.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/deprecation/reporting.rb b/activesupport/lib/active_support/deprecation/reporting.rb
index 5d7e241d1a..0529da342f 100644
--- a/activesupport/lib/active_support/deprecation/reporting.rb
+++ b/activesupport/lib/active_support/deprecation/reporting.rb
@@ -3,7 +3,8 @@ module ActiveSupport
class << self
attr_accessor :silenced
- # Outputs a deprecation warning to the output configured by <tt>ActiveSupport::Deprecation.behavior</tt>
+ # Outputs a deprecation warning to the output configured by
+ # <tt>ActiveSupport::Deprecation.behavior</tt>.
#
# ActiveSupport::Deprecation.warn("something broke!")
# # => "DEPRECATION WARNING: something broke! (called from your_code.rb:1)"
@@ -15,6 +16,14 @@ module ActiveSupport
end
# Silence deprecation warnings within the block.
+ #
+ # ActiveSupport::Deprecation.warn("something broke!")
+ # # => "DEPRECATION WARNING: something broke! (called from your_code.rb:1)"
+ #
+ # Activesupport::Deprecation.silence do
+ # ActiveSupport::Deprecation.warn("something broke!")
+ # end
+ # # => nil
def silence
old_silenced, @silenced = @silenced, true
yield