Permalink
Browse files

* ext/psych/lib/psych/visitors/yaml_tree.rb: keep a reference to

  custom coders so that GC does not impact dumped yaml reference ids.

Fixes #60
  • Loading branch information...
1 parent 9316aa3 commit 1606060069c13b2bcdc672a1a0e89202a9eb5166 @tenderlove committed May 15, 2012
Showing with 7 additions and 0 deletions.
  1. +5 −0 CHANGELOG.rdoc
  2. +2 −0 lib/psych/visitors/yaml_tree.rb
View
5 CHANGELOG.rdoc
@@ -1,3 +1,8 @@
+Wed May 16 01:15:45 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: keep a reference to
+ custom coders so that GC does not impact dumped yaml reference ids.
+
Mon Apr 30 04:43:53 2012 Aaron Patterson <aaron@tenderlovemaking.com>
* ext/psych/lib/psych/json/yaml_events.rb: implicit styles should not
View
2 lib/psych/visitors/yaml_tree.rb
@@ -20,6 +20,7 @@ def initialize options = {}, emitter = TreeBuilder.new, ss = ScalarScanner.new
@st = {}
@ss = ss
@options = options
+ @coders = []
@dispatch_cache = Hash.new do |h,klass|
method = "visit_#{(klass.name || '').split('::').join('_')}"
@@ -406,6 +407,7 @@ def register target, yaml_obj
end
def dump_coder o
+ @coders << o
tag = Psych.dump_tags[o.class]
unless tag
klass = o.class == Object ? nil : o.class.name

0 comments on commit 1606060

Please sign in to comment.