diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-04-05 11:03:18 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-04-05 11:03:18 -0700 |
commit | 40df3b13deef0f1add3576428d3a7ab22197282d (patch) | |
tree | c5f19ab0388e29e9078cef8a75f1f24661d369b6 | |
parent | 54972490a4d3c3d84cf5e6b6ae04fc5dbfef7281 (diff) | |
parent | d28928569780d564e944b3a59b012ad40f10b93f (diff) | |
download | psych-40df3b13deef0f1add3576428d3a7ab22197282d.tar.gz |
Merge pull request #122 from tjwallace/fix_coder_emit_hash
Fix case when map includes a symbol key in #emit_coder
-rw-r--r-- | lib/psych/visitors/yaml_tree.rb | 2 | ||||
-rw-r--r-- | test/psych/test_coder.rb | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/psych/visitors/yaml_tree.rb b/lib/psych/visitors/yaml_tree.rb index 6b6a5ff..96640e0 100644 --- a/lib/psych/visitors/yaml_tree.rb +++ b/lib/psych/visitors/yaml_tree.rb @@ -463,7 +463,7 @@ module Psych when :map @emitter.start_mapping nil, c.tag, c.implicit, c.style c.map.each do |k,v| - @emitter.scalar k, nil, nil, true, false, Nodes::Scalar::ANY + accept k accept v end @emitter.end_mapping diff --git a/test/psych/test_coder.rb b/test/psych/test_coder.rb index 4809b13..7571e89 100644 --- a/test/psych/test_coder.rb +++ b/test/psych/test_coder.rb @@ -85,7 +85,7 @@ module Psych end def encode_with coder - coder.represent_map self.class.name, { 'a' => 'b' } + coder.represent_map self.class.name, { "string" => 'a', :symbol => 'b' } end end @@ -131,7 +131,7 @@ module Psych def test_represent_map thing = Psych.load(Psych.dump(RepresentWithMap.new)) - assert_equal({ 'a' => 'b' }, thing.map) + assert_equal({ "string" => 'a', :symbol => 'b' }, thing.map) end def test_represent_sequence |