mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
ddf7ed8516
commit
c62aca26c5
3 changed files with 15 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue