dump( obj, io = nil )
public
Converts obj to YAML and writes the YAML result to io.
File.open( 'animals.yaml', 'w' ) do |out|
YAML.dump( ['badger', 'elephant', 'tiger'], out )
end
If no io is provided, a string containing the dumped YAML is returned.
YAML.dump( :locked )
# File lib/yaml.rb, line 116
def YAML.dump( obj, io = nil )
obj.to_yaml( io || io2 = StringIO.new )
io || ( io2.rewind; io2.read )
end