diff options
author | why <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-15 17:54:32 +0000 |
---|---|---|
committer | why <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-15 17:54:32 +0000 |
commit | 2fb73a8b0a41460ab886989f4e2380b53ca0e016 (patch) | |
tree | 732726227046fe116074ba6b46289b7fafdf5769 /lib/yaml.rb | |
parent | 808becf9e0919d5e155be1574d364ada6046c111 (diff) |
* lib/yaml.rb (quick_emit): use combination of object_id and hash to
identify repeated object references, since GC will reuse memory of
objects during output of YAML. [ruby-Bugs-8548] [ruby-Bugs-3698]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/yaml.rb')
-rw-r--r-- | lib/yaml.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/yaml.rb b/lib/yaml.rb index fe8335c8f0..a8da42a321 100644 --- a/lib/yaml.rb +++ b/lib/yaml.rb @@ -384,6 +384,10 @@ module YAML else emitter.reset( opts ) end + oid = + case oid when Fixnum, NilClass; oid + else oid = "#{oid.object_id}-#{oid.hash}" + end out.emit( oid, &e ) end |