From: "Haase, Konstantin" Date: 2011-10-26T02:22:21+09:00 Subject: [ruby-core:40365] Re: [ruby-trunk - Feature #5479] import StringIO into core, add String#to_io My main request was to add String#to_io, as Aaron described, so this protocol can actually be used. This is the only reason why I proposed moving StringIO to core. We could also add String#to_io as a monkey-patch to String in stringio in the stdlib. Konstantin On Oct 25, 2011, at 10:05 , Aaron Patterson wrote: > On Tue, Oct 25, 2011 at 10:14:54PM +0900, Charles Nutter wrote: >> >> Issue #5479 has been updated by Charles Nutter. >> >> >> I assume the IO produced from a StringIO would not have a real file descriptor, since...it doesn't have a real file descriptor. >> >> Could be done in JRuby using a ByteArrayInputStream. I'm not sure what it would mean to have read *and* write support though. Is that what's requested here? A pseudo-IO that reads from and writes to an area of memory? > > Yes, that's exactly what it is. JRuby already implements StringIO from > stdlib. I think Konstantin is just asking for: > > 1. You don't need to require stringio for it to be available > > 2. An implementation of `to_io` on String like this: > > class String > def to_io; StringIO.new self; end > end > > -- > Aaron Patterson > http://tenderlovemaking.com/