mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/syck/emitter.c: new emitter code.
* ext/syck/rubyext.c: Emitter class. * lib/yaml.rb: Load Syck emitter, if available. * lib/yaml/stream.rb: ditto. * lib/yaml/baseemitter.rb: underlying class for all emitters. * lib/yaml/rubytypes.rb: use BaseEmitter abstraction. * lib/yaml/emitter.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
30399f6c75
commit
a1e257ec48
9 changed files with 359 additions and 271 deletions
|
@ -53,14 +53,14 @@ class Hash
|
|||
opts[:DocType] = self.class if Hash === opts
|
||||
YAML::quick_emit( self.object_id, opts ) { |out|
|
||||
hash_type = to_yaml_type
|
||||
if not out.options[:ExplicitTypes] and hash_type == "!map"
|
||||
if not out.options(:ExplicitTypes) and hash_type == "!map"
|
||||
hash_type = ""
|
||||
end
|
||||
out.map( hash_type ) { |map|
|
||||
#
|
||||
# Sort the hash
|
||||
#
|
||||
if out.options[:SortKeys]
|
||||
if out.options(:SortKeys)
|
||||
map.concat( self.sort )
|
||||
else
|
||||
map.concat( self.to_a )
|
||||
|
@ -213,7 +213,7 @@ class Array
|
|||
opts[:DocType] = self.class if Hash === opts
|
||||
YAML::quick_emit( self.object_id, opts ) { |out|
|
||||
array_type = to_yaml_type
|
||||
if not out.options[:ExplicitTypes] and array_type == "!seq"
|
||||
if not out.options(:ExplicitTypes) and array_type == "!seq"
|
||||
array_type = ""
|
||||
end
|
||||
|
||||
|
@ -302,7 +302,7 @@ class String
|
|||
end
|
||||
end
|
||||
if not complex
|
||||
ostr = if out.options[:KeepValue]
|
||||
ostr = if out.options(:KeepValue)
|
||||
self
|
||||
elsif empty?
|
||||
"''"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue