Skip to content

Commit 4183fb0

Browse files
author
Zachary Scott
committed
Merge pull request rails#18568 from vipulnsward/removed-deprecated-methods-from-docs
Removed documentation of deprecated removed methods
2 parents 093e3e8 + e0badb4 commit 4183fb0

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

guides/source/active_support_core_extensions.md

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -467,34 +467,18 @@ C.new(0, 1).instance_variable_names # => ["@x", "@y"]
467467

468468
NOTE: Defined in `active_support/core_ext/object/instance_variables.rb`.
469469

470-
### Silencing Warnings, Streams, and Exceptions
470+
### Silencing Warnings and Exceptions
471471

472472
The methods `silence_warnings` and `enable_warnings` change the value of `$VERBOSE` accordingly for the duration of their block, and reset it afterwards:
473473

474474
```ruby
475475
silence_warnings { Object.const_set "RAILS_DEFAULT_LOGGER", logger }
476476
```
477477

478-
You can silence any stream while a block runs with `silence_stream`:
479-
480-
```ruby
481-
silence_stream(STDOUT) do
482-
# STDOUT is silent here
483-
end
484-
```
485-
486-
The `quietly` method addresses the common use case where you want to silence STDOUT and STDERR, even in subprocesses:
487-
488-
```ruby
489-
quietly { system 'bundle install' }
490-
```
491-
492-
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.
493-
494478
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:
495479

496480
```ruby
497-
# If the user is locked the increment is lost, no big deal.
481+
# If the user is locked, the increment is lost, no big deal.
498482
suppress(ActiveRecord::StaleObjectError) do
499483
current_user.increment! :visits
500484
end

0 commit comments

Comments
 (0)