Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix case when map includes a symbol key in #emit_coder #122

Merged
merged 1 commit into from

2 participants

@tjwallace

Mimic what is done in #visit_Hash. Fixes #107.

@tenderlove tenderlove merged commit 40df3b1 into from
@tjwallace tjwallace deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 30, 2013
  1. @tjwallace

    Fix case when map includes a symbol key in #emit_coder

    tjwallace authored
    Mimic what is done in #visit_Hash. Fixes #107.
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 3 deletions.
  1. +1 −1  lib/psych/visitors/yaml_tree.rb
  2. +2 −2 test/psych/test_coder.rb
View
2  lib/psych/visitors/yaml_tree.rb
@@ -440,7 +440,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
4 test/psych/test_coder.rb
@@ -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
Something went wrong with that request. Please try again.