mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/psych/lib/psych/visitors/to_ruby.rb: anonymous structs
should be able to roundtrip. Thanks @splattael! * test/psych/test_object_references.rb: test for change git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5c0d17c9a2
commit
7c6e4f8f38
3 changed files with 14 additions and 1 deletions
|
@ -1,3 +1,10 @@
|
|||
Thu Jan 9 09:51:00 2014 Aaron Patterson <aaron@tenderlovemaking.com>
|
||||
|
||||
* ext/psych/lib/psych/visitors/to_ruby.rb: anonymous structs
|
||||
should be able to roundtrip. Thanks @splattael!
|
||||
|
||||
* test/psych/test_object_references.rb: test for change
|
||||
|
||||
Wed Jan 8 22:53:16 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* vm_insnhelper.c (vm_search_super_method): when super called in a
|
||||
|
|
|
@ -181,9 +181,11 @@ module Psych
|
|||
klass = class_loader.struct
|
||||
members = o.children.map { |c| accept c }
|
||||
h = Hash[*members]
|
||||
klass.new(*h.map { |k,v|
|
||||
s = klass.new(*h.map { |k,v|
|
||||
class_loader.symbolize k
|
||||
}).new(*h.map { |k,v| v })
|
||||
register(o, s)
|
||||
s
|
||||
end
|
||||
|
||||
when /^!ruby\/object:?(.*)?$/
|
||||
|
|
|
@ -26,6 +26,10 @@ module Psych
|
|||
assert_reference_trip DateTime.now
|
||||
end
|
||||
|
||||
def test_struct_has_references
|
||||
assert_reference_trip Struct.new(:foo).new(1)
|
||||
end
|
||||
|
||||
def assert_reference_trip obj
|
||||
yml = Psych.dump([obj, obj])
|
||||
assert_match(/\*-?\d+/, yml)
|
||||
|
|
Loading…
Reference in a new issue