How is one supposed to get a string from a StringIO?  If it is an
extension of string should it not support the new to_str method?

brains hgs 38 %> ./!$
./StringIOtest.rb
"#<StringIO:0xf1310>"
"#<StringIO:0xf1310>"
./StringIOtest.rb:12: undefined method `to_str' for
#<StringIO:0xf1310> (NoMethodError)
brains hgs 39 %> ruby --version
ruby 1.8.1 (2003-12-25) [sparc-solaris2.9]
brains hgs 40 %> cat ./StringIOtest.rb
#!/usr/local/bin/ruby

require 'stringio'

string = "a string."
stream = StringIO.new(string)

stream << ' More text'

p stream.inspect
p stream.to_s
p stream.to_str
brains hgs 41 %>

The result of p looks add

brains hgs 42 %>  ruby -e "x = 'y'; p x.inspect"
"\"y\""
brains hgs 43 %>
is more what I was expecting -- i.e the StringIO's contents.


        Hugh