aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-05 19:51:12 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-05 19:51:12 +0000
commitc62aca26c561d7ff129d4408c81cb6f838490509 (patch)
tree502baf00377f253432a3825b547e3007149055f6
parentddf7ed8516354dcb4048030bd445d2f9a17c2cd0 (diff)
downloadruby-c62aca26c561d7ff129d4408c81cb6f838490509.tar.gz
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--ext/psych/lib/psych/visitors/yaml_tree.rb2
-rw-r--r--test/psych/test_date_time.rb8
3 files changed, 15 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 3106ad9f9c..d6fd2ca577 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Sat Jul 6 04:49:38 2013 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * 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@ruby-lang.org>
* test/ruby/test_unicode_escape.rb (TestUnicodeEscape#test_basic): this
diff --git a/ext/psych/lib/psych/visitors/yaml_tree.rb b/ext/psych/lib/psych/visitors/yaml_tree.rb
index 3f41f6b5ae..24cbe87f80 100644
--- a/ext/psych/lib/psych/visitors/yaml_tree.rb
+++ b/ext/psych/lib/psych/visitors/yaml_tree.rb
@@ -216,7 +216,7 @@ module Psych
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
diff --git a/test/psych/test_date_time.rb b/test/psych/test_date_time.rb
index df66d142f6..9a8e37bc67 100644
--- a/test/psych/test_date_time.rb
+++ b/test/psych/test_date_time.rb
@@ -13,5 +13,13 @@ module Psych
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