From: Logan Capaldo Date: 2006-03-08T03:28:17+09:00 Subject: Re: How to capture eval's stdout in 1.8? --Apple-Mail-27-240121866 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On Mar 7, 2006, at 7:58 AM, Stephen Waits wrote: > a) assignment to $stdout (which deprecates $defout) is deprecated Are you sure? -w gives me no Object#type is deprecated use Object#class style warnings % cat moving_stdout.rb require 'stringio' old_stdout = $stdout $stdout = StringIO.new puts "Hello" old_stdout.puts "The real console" old_stdout.puts "Caputured stdout: #{$stdout.string}" $stdout = old_stdout puts "Back to normal" % ruby -w moving_stdout.rb The real console Caputured stdout: Hello Back to normal % ruby -v ruby 1.8.4 (2005-12-24) [powerpc-darwin8.4.0] --Apple-Mail-27-240121866--