method
to_yaml
v2_5_5 -
Show latest stable
-
0 notes -
Class: Specification
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180
- 1_9_3_125 (0)
- 1_9_3_392 (0)
- 2_1_10 (0)
- 2_2_9 (0)
- 2_4_6 (0)
- 2_5_5 (0)
- 2_6_3 (0)
- What's this?
to_yaml(opts = {})
public
Hide source
# File lib/rubygems/specification.rb, line 2614 def to_yaml(opts = {}) # :nodoc: if (YAML.const_defined?(:ENGINE) && !YAML::ENGINE.syck?) || (defined?(Psych) && YAML == Psych) then # 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 if Object.const_defined? :Encoding Psych::Visitors::Emitter.new(io).accept(ast) io.string.gsub(/ !!null \n/, " \n") else YAML.quick_emit object_id, opts do |out| out.map taguri, to_yaml_style do |map| encode_with map end end end end