Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Psych::Nodes::Node#to_yaml
to_yaml(io = nil, options = {})
ext/psych/lib/psych/nodes/node.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.4.1/ext/psych/lib/psych/nodes/node.rb, line 57
def yaml io = nil, options = {}
require "stringio"
real_io = io || StringIO.new(''.encode('utf-8'))
Visitors::Emitter.new(real_io, options).accept self
return real_io.string unless io
io
end
Alias of #yaml
Convert this node to YAML.
See also Psych::Visitors::Emitter