Module: Spout::Helpers::Quietly
- Included in:
- Commands::Deploy
- Defined in:
- lib/spout/helpers/quietly.rb
Overview
Silences output for tests
Instance Method Summary collapse
-
#quietly ⇒ Object
From Rails: apidock.com/rails/v3.2.13/Kernel/quietly.
-
#silence_stream(stream) ⇒ Object
From Rails: apidock.com/rails/v3.2.13/Kernel/silence_stream.
Instance Method Details
#quietly ⇒ Object
From Rails: apidock.com/rails/v3.2.13/Kernel/quietly
18 19 20 21 22 23 24 |
# File 'lib/spout/helpers/quietly.rb', line 18 def quietly silence_stream(STDOUT) do silence_stream(STDERR) do yield end end end |
#silence_stream(stream) ⇒ Object
From Rails: apidock.com/rails/v3.2.13/Kernel/silence_stream
8 9 10 11 12 13 14 15 |
# File 'lib/spout/helpers/quietly.rb', line 8 def silence_stream(stream) old_stream = stream.dup stream.reopen(/mswin|mingw/ =~ RbConfig::CONFIG["host_os"] ? "NUL:" : "/dev/null") stream.sync = true yield ensure stream.reopen(old_stream) end |