Permalink
Browse files

Merge pull request #122 from tjwallace/fix_coder_emit_hash

Fix case when map includes a symbol key in #emit_coder
  • Loading branch information...
2 parents 5497249 + d289285 commit 40df3b13deef0f1add3576428d3a7ab22197282d @tenderlove tenderlove committed Apr 5, 2013
Showing with 3 additions and 3 deletions.
  1. +1 −1 lib/psych/visitors/yaml_tree.rb
  2. +2 −2 test/psych/test_coder.rb
@@ -463,7 +463,7 @@ def emit_coder c
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
View
@@ -85,7 +85,7 @@ def init_with coder
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 @@ def test_map_with_tag_and_style
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

0 comments on commit 40df3b1

Please sign in to comment.