ruby-changes:29752
From: tenderlove <ko1@a...>
Date: Sat, 6 Jul 2013 04:51:25 +0900 (JST)
Subject: [ruby-changes:29752] tenderlove:r41804 (trunk): * ext/psych/lib/psych/visitors/yaml_tree.rb: register time objects so
tenderlove 2013-07-06 04:51:12 +0900 (Sat, 06 Jul 2013) New Revision: 41804 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41804 Log: * ext/psych/lib/psych/visitors/yaml_tree.rb: register time objects so they are referenced as ids during output. * test/psych/test_date_time.rb: corresponding test. Modified files: trunk/ChangeLog trunk/ext/psych/lib/psych/visitors/yaml_tree.rb trunk/test/psych/test_date_time.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 41803) +++ ChangeLog (revision 41804) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sat Jul 6 04:49:38 2013 Aaron Patterson <aaron@t...> + + * ext/psych/lib/psych/visitors/yaml_tree.rb: register time objects so + they are referenced as ids during output. + * test/psych/test_date_time.rb: corresponding test. + Fri Jul 5 20:46:39 2013 NAKAMURA Usaku <usa@r...> * test/ruby/test_unicode_escape.rb (TestUnicodeEscape#test_basic): this Index: ext/psych/lib/psych/visitors/yaml_tree.rb =================================================================== --- ext/psych/lib/psych/visitors/yaml_tree.rb (revision 41803) +++ ext/psych/lib/psych/visitors/yaml_tree.rb (revision 41804) @@ -216,7 +216,7 @@ module Psych https://github.com/ruby/ruby/blob/trunk/ext/psych/lib/psych/visitors/yaml_tree.rb#L216 def visit_Time o formatted = format_time o - @emitter.scalar formatted, nil, nil, true, false, Nodes::Scalar::ANY + register o, @emitter.scalar(formatted, nil, nil, true, false, Nodes::Scalar::ANY) end def visit_Rational o Index: test/psych/test_date_time.rb =================================================================== --- test/psych/test_date_time.rb (revision 41803) +++ test/psych/test_date_time.rb (revision 41804) @@ -13,5 +13,13 @@ module Psych https://github.com/ruby/ruby/blob/trunk/test/psych/test_date_time.rb#L13 dt = DateTime.now assert_cycle dt end + + def test_alias_with_time + t = Time.now + h = {:a => t, :b => t} + yaml = Psych.dump h + assert_match('&', yaml) + assert_match('*', yaml) + end end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/