Method: Psych.dump_stream

Defined in:
lib/psych.rb

.dump_stream(*objects) ⇒ Object

Dump a list of objects as separate documents to a document stream.

Example:

Psych.dump_stream("foo\n  ", {}) # => "--- ! \"foo\\n  \"\n--- {}\n"


613
614
615
616
617
618
619
# File 'lib/psych.rb', line 613

def self.dump_stream *objects
  visitor = Psych::Visitors::YAMLTree.create({})
  objects.each do |o|
    visitor << o
  end
  visitor.tree.yaml
end