On Apr 16, 2010, at 05:33 , Martin Hansen wrote: > # Reads the next 'record' from the I/O stream. The records are > separated by > # lines of "---" and each record consists of a varying number of lines > with a > # key/value pair separated by ": ". The record is returned as a hash. > def get_record I'm not sure why nobody bothered to point this out, or maybe I'm missing something... > require "yaml" > s = "--- > a: b > c: d > " > > p YAML.load(s) > # => {"a"=>"b", "c"=>"d"} Also: > % ri YAML.load_documents > > (from ruby core) > ------------------------------------------------------------------------------ > load_documents( io, &doc_proc ) > > ------------------------------------------------------------------------------ > > Calls block with each consecutive document in the YAML stream contained > in io. > > File.open( 'many-docs.yaml' ) do |yf| > YAML.load_documents( yf ) do |ydoc| > ## ydoc contains the single object > ## from the YAML document > end > end