Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

* 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.

Fixes #146
  • Loading branch information...
commit 5258fab369546994131bd4ca0b57ff7e7f0b0241 1 parent fdb594d
@tenderlove tenderlove authored
View
6 CHANGELOG.rdoc
@@ -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.
+
Wed May 15 02:22:16 2013 Aaron Patterson <aaron@tenderlovemaking.com>
* ext/psych/lib/psych.rb: Adding Psych.safe_load for loading a user
View
2  lib/psych/visitors/yaml_tree.rb
@@ -216,7 +216,7 @@ def visit_DateTime o
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
View
8 test/psych/test_date_time.rb
@@ -13,5 +13,13 @@ def test_round_trip
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
Please sign in to comment.
Something went wrong with that request. Please try again.