Class IORedirect
In: lib/more/facets/ioredirect.rb
Parent: Object

IORedirect

A class to redirect $stdout, or other IO object, to a StringIO object, or any other object with a write() method.

  s = StringIO.new
  r = IORedirect.redirect($stdout, s) do
    $stdout.puts "this is a test"
  end

Methods

new   redirect   start   stop  

Public Class methods

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.

An exception-safe class method for redirection

Public Instance methods

Start redirection, if it has not already been started.

Stop redirection, if it is occurring

[Validate]