[前][次][番号順一覧][スレッド一覧]

ruby-changes:28090

From: tenderlove <ko1@a...>
Date: Sat, 6 Apr 2013 03:13:04 +0900 (JST)
Subject: [ruby-changes:28090] tenderlove:r40142 (trunk): * ext/psych/lib/psych/visitors/yaml_tree.rb: fix symbol keys in coder

tenderlove	2013-04-06 03:12:52 +0900 (Sat, 06 Apr 2013)

  New Revision: 40142

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40142

  Log:
    * ext/psych/lib/psych/visitors/yaml_tree.rb: fix symbol keys in coder
      emission.  Thanks @tjwallace
    * test/psych/test_coder.rb: test for change

  Modified files:
    trunk/ChangeLog
    trunk/ext/psych/lib/psych/visitors/yaml_tree.rb
    trunk/test/psych/test_coder.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 40141)
+++ ChangeLog	(revision 40142)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Apr  6 03:11:07 2013  Aaron Patterson <aaron@t...>
+
+	* ext/psych/lib/psych/visitors/yaml_tree.rb: fix symbol keys in coder
+	  emission.  Thanks @tjwallace
+	* test/psych/test_coder.rb: test for change
+
 Sat Apr  6 02:54:08 2013  Aaron Patterson <aaron@t...>
 
 	* ext/psych/lib/psych/exception.rb: there should be only one exception
Index: ext/psych/lib/psych/visitors/yaml_tree.rb
===================================================================
--- ext/psych/lib/psych/visitors/yaml_tree.rb	(revision 40141)
+++ ext/psych/lib/psych/visitors/yaml_tree.rb	(revision 40142)
@@ -463,7 +463,7 @@ module Psych https://github.com/ruby/ruby/blob/trunk/ext/psych/lib/psych/visitors/yaml_tree.rb#L463
         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
Index: test/psych/test_coder.rb
===================================================================
--- test/psych/test_coder.rb	(revision 40141)
+++ test/psych/test_coder.rb	(revision 40142)
@@ -85,7 +85,7 @@ module Psych https://github.com/ruby/ruby/blob/trunk/test/psych/test_coder.rb#L85
       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 https://github.com/ruby/ruby/blob/trunk/test/psych/test_coder.rb#L131
 
     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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]