class Object
Public Instance Methods
converse(*with, &block)
click to toggle source
Splits output between all given IO instances. @param [*IO] with The IO instances to split between.
# File lib/quietly.rb, line 12 def converse(*with, &block) whisper Quietly::JointIO.new(*with), true, &block end
quietly(&block)
click to toggle source
Silences all output to STDOUT.
# File lib/quietly.rb, line 3 def quietly(&block); whisper File.new(File::NULL,"w"), false, &block end
silently(&block)
click to toggle source
Silences all output to STDOUT and STDERR.
# File lib/quietly.rb, line 7 def silently(&block); whisper File.new(File::NULL,"w"), true, &block end
whisper(to, redir_errs=false) { || ... }
click to toggle source
Redirects output to the given IO instance. @param [IO] to The IO instance to redirect to. @param [Boolean] redir_errs If true, redirects STDERR as well as STDOUT.
# 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