In Java, one can create an IO stream from a String like so:
在Java中,可以从String创建IO流,如下所示:
Reader r = new StringReader("my text");
I'd like to be able to do the same in Ruby so I can take a string and treat it as an IO stream.
我希望能够在Ruby中执行相同的操作,因此我可以将字符串视为IO流。