diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-06-05 22:42:58 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-06-05 22:42:58 +0000 |
commit | 3f6eafaaa0707e11ef4b9fe5f13a1cc98de30388 (patch) | |
tree | dbe39b224c5f17a8d2f521fac78d8f7c9fc398af /ext/psych/lib/psych | |
parent | 88fda023aaa08ddb5b69fe4cb7e071ca23f13d26 (diff) |
* 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
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/psych/lib/psych')
-rw-r--r-- | ext/psych/lib/psych/visitors/yaml_tree.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/psych/lib/psych/visitors/yaml_tree.rb b/ext/psych/lib/psych/visitors/yaml_tree.rb index ff0fcd204c..96260daffa 100644 --- a/ext/psych/lib/psych/visitors/yaml_tree.rb +++ b/ext/psych/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 |