From: Ryan Davis Date: 2007-11-21T19:18:20+09:00 Subject: Re: STDOUT to StringIO On Nov 21, 2007, at 01:15 , Fredrik wrote: > I know that I can redirect my standard output to a file like this: > > STDOUT.reopen(File.open(filename,'w')) > > But then, why can't I redirect it to a string like this? : > > output = StringIO.open('','w') > STDOUT.reopen(output) >> TypeError: can't convert StringIO into String > > Can somebody see what I am doing wrong? >> $stderr = output => # >> warn "blah" => nil >> output.string => "blah\n"