Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
class method
Psych.dump_stream
dump_stream(*objects)
ext/psych/lib/psych.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.4.1/ext/psych/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
Dump a list of objects as separate documents to a document stream.
Example:
Example
Psych.dump_stream("foo\n ", {}) # => "--- ! \"foo\\n \"\n--- {}\n"