Project

General

Profile

Actions

Bug #10496

closed

Yaml: Serialization of cross-referrenced objects with psych

Added by jonnykh (Ivan Neverov) over 9 years ago. Updated about 9 years ago.

Status:
Closed
Target version:
-
ruby -v:
2.1.3p242, 1.9.3p550
[ruby-core:66215]

Description

I'm trying to run next code that serialize object B that has instance variable of A initialized with this B (cross referenced). After deserialization I'm getting 2 B objects instead of 1

https://gist.github.com/ineverov/3ce3ea21d970996b673e

During investigation of source code of psych I found that we don't register objects that use encode_with methods
Here: https://github.com/ruby/ruby/blob/trunk/ext/psych/lib/psych/visitors/yaml_tree.rb#L530

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0