Editing Topic: RCR111 Project: RCR | 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.



Back to RCRchive.


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