ioredirect.rb

Path: lib/more/facets/ioredirect.rb
Last Update: Tue Oct 28 06:39:06 -0400 2008

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 = Redirector.redirect($stdout, s) do
    $stdout.puts "this is a test"
  end

History

  • IORedirect was ported from Paul Brannan‘s Ruby Treasures.

Authors

  • Paul Brannan <paul@atdesk.com>

Copying

Copyright (C) 2002 Paul Brannan <paul@atdesk.com>

Ruby License

This module is free software. You may use, modify, and/or redistribute this software under the same terms as Ruby.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[Validate]