method
to_yaml
v2_6_3 -
Show latest stable
- Class:
Gem::Specification
to_yaml(opts = {})public
No documentation available.
# File lib/rubygems/specification.rb, line 2592
def to_yaml(opts = {}) # :nodoc:
# Because the user can switch the YAML engine behind our
# back, we have to check again here to make sure that our
# psych code was properly loaded, and load it if not.
unless Gem.const_defined?(:NoAliasYAMLTree)
require 'rubygems/psych_tree'
end
builder = Gem::NoAliasYAMLTree.create
builder << self
ast = builder.tree
io = StringIO.new
io.set_encoding Encoding::UTF_8
Psych::Visitors::Emitter.new(io).accept(ast)
io.string.gsub(/ !!null \n/, " \n")
end