2009-06-09 68 views

回答

11
r = StringIO.new("my text") 

here's the documentation

+1

一個關鍵的問題是我(它在文檔中,我只是錯過了)是爲了得到結果,你使用#string而不是#to_s。 #to_s只是告訴你這是一個StringIO。 #string爲您提供建立的結果。 – 2009-06-09 12:13:15

相關問題