Class IO::Redirect
In: lib/facet/io-redirect.rb
Parent: Object

Description

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

Synopsis

  require 'raspberry/new/io-redirect'

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

Author(s)

  • Paul Brannan

Methods

new   redirect   start   stop  

Constants

VERSION = '1.0.0'

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]