Class | IORedirect
In: | lib/facets/more/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.

## Synopsis

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

### Methods

new redirect start stop

### Public Class methods

new(from, to)

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) {|| ...}

An exception-safe class method for redirection

### Public Instance methods

start()

Start redirection, if it has not already been started.

stop()

Stop redirection, if it is occurring

[Validate]