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(-) (limited to 'activesupport/lib/active_support/deprecation/reporting.rb') 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 From 6285675db1cf983ba6c15442aedb457c8041f5ee Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Fri, 22 Jun 2012 22:14:29 +0530 Subject: fixes a few mistakes in api docs [ci skip] --- activesupport/lib/active_support/deprecation/reporting.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib/active_support/deprecation/reporting.rb') diff --git a/activesupport/lib/active_support/deprecation/reporting.rb b/activesupport/lib/active_support/deprecation/reporting.rb index 0529da342f..a1e9618084 100644 --- a/activesupport/lib/active_support/deprecation/reporting.rb +++ b/activesupport/lib/active_support/deprecation/reporting.rb @@ -20,7 +20,7 @@ module ActiveSupport # ActiveSupport::Deprecation.warn("something broke!") # # => "DEPRECATION WARNING: something broke! (called from your_code.rb:1)" # - # Activesupport::Deprecation.silence do + # ActiveSupport::Deprecation.silence do # ActiveSupport::Deprecation.warn("something broke!") # end # # => nil -- cgit v1.2.3