push data to string : StringIO « File Directory « Ruby






push data to string


require 'stringio'
s = StringIO.new
s << "A string"
s.read
s << ", and more."
s.rewind
s.read                                # => "A string, and more."

 








Related examples in the same category

1.Performing Random Access on Read-Once Input Streams
2.Pretending a String is a File
3.Write to a string
4.YAML.dump
5.Find the fifth byte
6.Redirecting Standard Input or Output