ruby-changes:18436
From: tenderlove <ko1@a...>
Date: Thu, 6 Jan 2011 02:58:43 +0900 (JST)
Subject: [ruby-changes:18436] Ruby:r30459 (trunk): * ext/psych/lib/psych/visitors/yaml_tree.rb: use YAML 1.0 output
tenderlove 2011-01-06 02:57:38 +0900 (Thu, 06 Jan 2011) New Revision: 30459 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30459 Log: * ext/psych/lib/psych/visitors/yaml_tree.rb: use YAML 1.0 output format for serializing nil values. Thanks Eric Hodel! * test/psych/test_nil.rb: test for nil values Added files: trunk/test/psych/test_nil.rb Modified files: trunk/ChangeLog trunk/ext/psych/lib/psych/visitors/yaml_tree.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 30458) +++ ChangeLog (revision 30459) @@ -1,3 +1,10 @@ +Thu Jan 6 02:55:48 2011 Aaron Patterson <aaron@t...> + + * ext/psych/lib/psych/visitors/yaml_tree.rb: use YAML 1.0 output + format for serializing nil values. Thanks Eric Hodel! + + * test/psych/test_nil.rb: test for nil values + Wed Jan 5 14:21:34 2011 Mark Dodwell <hi@m...> * string.c: fix rdoc typo. Index: ext/psych/lib/psych/visitors/yaml_tree.rb =================================================================== --- ext/psych/lib/psych/visitors/yaml_tree.rb (revision 30458) +++ ext/psych/lib/psych/visitors/yaml_tree.rb (revision 30459) @@ -279,7 +279,7 @@ end def visit_NilClass o - @emitter.scalar('', nil, 'tag:yaml.org,2002:null', false, false, Nodes::Scalar::ANY) + @emitter.scalar('', nil, 'tag:yaml.org,2002:null', true, false, Nodes::Scalar::ANY) end def visit_Symbol o Index: test/psych/test_nil.rb =================================================================== --- test/psych/test_nil.rb (revision 0) +++ test/psych/test_nil.rb (revision 30459) @@ -0,0 +1,18 @@ +require_relative 'helper' + +module Psych + class TestNil < TestCase + def test_nil + yml = Psych.dump nil + assert_equal "--- \n...\n", yml + assert_equal nil, Psych.load(yml) + end + + def test_array_nil + yml = Psych.dump [nil] + assert_equal "---\n- \n", yml + assert_equal [nil], Psych.load(yml) + end + + end +end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/