From 5dabead1871ed0100674e3eeb4a9f549b1997a85 Mon Sep 17 00:00:00 2001 From: tenderlove Date: Thu, 8 Jan 2015 22:15:20 +0000 Subject: * ext/psych/lib/psych/visitors/to_ruby.rb: call `allocate` on hash subclasses. Fixes github.com/tenderlove/psych/issues/196 * test/psych/test_hash.rb: test for change git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/psych/lib/psych/visitors/to_ruby.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/psych/lib/psych') diff --git a/ext/psych/lib/psych/visitors/to_ruby.rb b/ext/psych/lib/psych/visitors/to_ruby.rb index adf38a21e8..f353e9c301 100644 --- a/ext/psych/lib/psych/visitors/to_ruby.rb +++ b/ext/psych/lib/psych/visitors/to_ruby.rb @@ -262,7 +262,7 @@ module Psych set when /^!ruby\/hash-with-ivars(?::(.*))?$/ - hash = $1 ? resolve_class($1).new : {} + hash = $1 ? resolve_class($1).allocate : {} o.children.each_slice(2) do |key, value| case key.value when 'elements' @@ -276,7 +276,7 @@ module Psych hash when /^!map:(.*)$/, /^!ruby\/hash:(.*)$/ - revive_hash register(o, resolve_class($1).new), o + revive_hash register(o, resolve_class($1).allocate), o when '!omap', 'tag:yaml.org,2002:omap' map = register(o, class_loader.psych_omap.new) -- cgit v1.2.3