YAML.dump : StringIO « File Directory « Ruby


require 'stringio'
require 'yaml'

s = StringIO.new
YAML.dump(['A list of', 3, :items], s)
puts s.string


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.Find the fifth byte
5.push data to string
6.Redirecting Standard Input or Output