module Psych

def self.load_stream yaml, filename = nil


list # => ['foo', 'bar']
end
list << ruby
Psych.load_stream("--- foo\n...\n--- bar\n...") do |ruby|
list = []

Psych.load_stream("--- foo\n...\n--- bar\n...") # => ['foo', 'bar']

Example:

and passed to the block during parsing
as a list. If a block is given, each document will be converted to Ruby
Load multiple documents given in +yaml+. Returns the parsed documents
##
def self.load_stream yaml, filename = nil
  if block_given?
    parse_stream(yaml, filename) do |node|
      yield node.to_ruby
    end
  else
    parse_stream(yaml, filename).children.map { |child| child.to_ruby }
  end
end