Comment on this RCR (edit wiki page) | RCRchive home

RCR 111: IO subclass for string

submitted by anonymous on 2002-06-26 14:35:18


This is a legacy RCR. If this is your RCR, please resubmit it using the new format and process.


I'd like to see a sub-class of IO that used a String for internal storage.
Something like:
a = IOString::new
a.puts "Hello, world!"
str = a.string # maybe a.to_s ?
puts str
b = IOString::open(str)
str = b.gets
puts str

I use this kind of structure to store parts of files in place, for parsing later... I created my own class to do this (which was easy, since I knew exactly which methods of IO I'd be talking to), but it seems like something that belongs in the standard library.


Vote for this RCR

Strongly opposed [0]
Opposed [0]
Neutral [1]
In favor [1]
Strongly advocate [0]

Change the status of this RCR to:

accepted

rejected

withdrawn


Add comments here

Try StringIO (matz, 2002-06-26 19:48:19)

..from RAA. It is bundled with 1.7 CVS snapshot.

matz.

Back to RCRchive.


RCR Submission page and RCRchive powered by Ruby, Apache, RuWiki (modified), and RubLog