YAML::load_stream Method
load_stream
Loads an entire YAML stream into a new YAML::Stream object.

YAML::load_stream(
  (String or IO) io
)

Parameters
io
The string or IO object to read from.
Return Values
A YAML::Stream object

Details

The YAML::load_stream method will iterate through the documents in a YAML stream, building them up inside of a YAML::Stream object:

readme_doc = YAML::load_stream( File.open( 'README' ) )
puts readme_doc.documents[0]['title']
# prints:
#   YAML.rb
Ex. 38: YAML::load_stream Example

Any options within the YAML stream are preserved in the YAML::Stream object and the IO object is closed upon completion of parsing.