diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-06-05 15:46:15 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-06-05 15:46:15 -0700 |
commit | 1695b6c7378b826ec1de64f07fccf6bc2f353017 (patch) | |
tree | e25bbe152df00d9e9d47707862a0be16c6d313d0 /lib/psych/visitors/yaml_tree.rb | |
parent | 90ce47ff8111099082923333d88e8447415fd3cf (diff) | |
download | psych-1695b6c7378b826ec1de64f07fccf6bc2f353017.zip |
* ext/psych/lib/psych/visitors/yaml_tree.rb: dump empty symbols with a
tag so that they can be parsed on input. [Bug #9873] [ruby-core:62825]
* test/psych/test_symbol.rb: test for change
Diffstat (limited to 'lib/psych/visitors/yaml_tree.rb')
-rw-r--r-- | lib/psych/visitors/yaml_tree.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/psych/visitors/yaml_tree.rb b/lib/psych/visitors/yaml_tree.rb index ff0fcd2..96260da 100644 --- a/lib/psych/visitors/yaml_tree.rb +++ b/lib/psych/visitors/yaml_tree.rb @@ -378,7 +378,11 @@ module Psych end def visit_Symbol o - @emitter.scalar ":#{o}", nil, nil, true, false, Nodes::Scalar::ANY + if o.empty? + @emitter.scalar "", nil, '!ruby/symbol', false, false, Nodes::Scalar::ANY + else + @emitter.scalar ":#{o}", nil, nil, true, false, Nodes::Scalar::ANY + end end private |