From: Hugh Sasse Staff Elec Eng Date: 2004-04-30T03:01:01+09:00 Subject: Re: Should StringIO support to_str ? On Fri, 30 Apr 2004, Gavin Sinclair wrote: > On Friday, April 30, 2004, 3:30:54 AM, Hugh wrote: > > > How is one supposed to get a string from a StringIO? > > #string That's better, but I don't see the part with which I initialized. brains hgs 49 %> cat !$ cat StringIOtest.rb #!/usr/local/bin/ruby require 'stringio' string = "a string." stream = StringIO.new(string) stream << ' More text' stream.rewind p stream.inspect p stream.to_s p stream.string p stream.string.class brains hgs 50 %> !$ StringIOtest.rb "#" "#" " More text" String brains hgs 51 %> Why not "a string. More text"? > > > If it is an extension of string should it not support the new to_str > > method? > > It's not an extension. It's a duck-extension :) A platypus? > > But yeah, I support the argument. > > Gavin > Thank you, Hugh