Top Level Namespace
Defined Under Namespace
Modules: Quietly
Instance Method Summary collapse
-
#converse(*with, &block) ⇒ Object
Splits output between all given IO instances.
-
#quietly(&block) ⇒ Object
Silences all output to STDOUT.
-
#silently(&block) ⇒ Object
Silences all output to STDOUT and STDERR.
-
#whisper(to, redir_errs = false, &block) ⇒ Object
Redirects output to the given IO instance.
Instance Method Details
#converse(*with, &block) ⇒ Object
Splits output between all given IO instances.
12 |
# File 'lib/quietly.rb', line 12 def converse(*with, &block) whisper Quietly::JointIO.new(*with), true, &block end |
#quietly(&block) ⇒ Object
Silences all output to STDOUT.
3 |
# File 'lib/quietly.rb', line 3 def quietly(&block); whisper File.new(File::NULL,"w"), false, &block end |
#silently(&block) ⇒ Object
Silences all output to STDOUT and STDERR.
7 |
# File 'lib/quietly.rb', line 7 def silently(&block); whisper File.new(File::NULL,"w"), true, &block end |
#whisper(to, redir_errs = false, &block) ⇒ Object
Redirects output to the given IO instance.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/quietly.rb', line 18 def whisper(to, redir_errs=false, &block) orig_stdout = $stdout.clone $stdout = to if redir_errs orig_stderr = $stderr.clone $stderr = to end yield ensure $stdout = orig_stdout $stderr = orig_stderr if redir_errs end |