A class to redirect $stdout, or other IO object, to a StringIO object, or any other object with a write() method.
Synopsis
require 'mega/io-redirect'
s = StringIO.new
r = Redirector.redirect($stdout, s) do
$stdout.puts "this is a test"
end
Author(s)
- Paul Brannan
Methods
Public Class methods
new(from, to)
[ source ]
Start redirection from one IO object to any other object with a write() method. from is the IO object to redirect from, and to is the object to redirect to.
redirect(from, to) {|| ...}
[ source ]
An exception-safe class method for redirection
Public Instance methods
start()
[ source ]
Start redirection, if it has not already been started.
stop()
[ source ]
Stop redirection, if it is occurring