diff options
author | Zachary Scott <e@zzak.io> | 2015-01-17 09:03:32 -0800 |
---|---|---|
committer | Zachary Scott <e@zzak.io> | 2015-01-17 09:03:32 -0800 |
commit | 4183fb0853720ee2ce370be3fb44dbeb152c9890 (patch) | |
tree | 84841e7e1609b6fc337ba7872c2cb6683cdd637d /guides/source/active_support_core_extensions.md | |
parent | 093e3e8046a36330babd3aa4580a36d8fab3d6d5 (diff) | |
parent | e0badb4a062d62cd51df6a905a5bcb148d575295 (diff) | |
download | rails-4183fb0853720ee2ce370be3fb44dbeb152c9890.tar.gz rails-4183fb0853720ee2ce370be3fb44dbeb152c9890.tar.bz2 rails-4183fb0853720ee2ce370be3fb44dbeb152c9890.zip |
Merge pull request #18568 from vipulnsward/removed-deprecated-methods-from-docs
Removed documentation of deprecated removed methods
Diffstat (limited to 'guides/source/active_support_core_extensions.md')
-rw-r--r-- | guides/source/active_support_core_extensions.md | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index 080cc41e87..d817885169 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -467,7 +467,7 @@ C.new(0, 1).instance_variable_names # => ["@x", "@y"] NOTE: Defined in `active_support/core_ext/object/instance_variables.rb`. -### Silencing Warnings, Streams, and Exceptions +### Silencing Warnings and Exceptions The methods `silence_warnings` and `enable_warnings` change the value of `$VERBOSE` accordingly for the duration of their block, and reset it afterwards: @@ -475,26 +475,10 @@ The methods `silence_warnings` and `enable_warnings` change the value of `$VERBO silence_warnings { Object.const_set "RAILS_DEFAULT_LOGGER", logger } ``` -You can silence any stream while a block runs with `silence_stream`: - -```ruby -silence_stream(STDOUT) do - # STDOUT is silent here -end -``` - -The `quietly` method addresses the common use case where you want to silence STDOUT and STDERR, even in subprocesses: - -```ruby -quietly { system 'bundle install' } -``` - -For example, the railties test suite uses that one in a few places to prevent command messages from being echoed intermixed with the progress status. - Silencing exceptions is also possible with `suppress`. This method receives an arbitrary number of exception classes. If an exception is raised during the execution of the block and is `kind_of?` any of the arguments, `suppress` captures it and returns silently. Otherwise the exception is reraised: ```ruby -# If the user is locked the increment is lost, no big deal. +# If the user is locked, the increment is lost, no big deal. suppress(ActiveRecord::StaleObjectError) do current_user.increment! :visits end |