From 508538066c54b88bd2cca243ceaf5b65c0bee4ec Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Sun, 17 Jun 2012 12:31:40 -0500 Subject: add example to AS::Deprecation#silence [ci skip] --- activesupport/lib/active_support/deprecation/reporting.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 ActiveSupport::Deprecation.behavior + # Outputs a deprecation warning to the output configured by + # ActiveSupport::Deprecation.behavior. # # 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 -- cgit v1.2.3