diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-01-08 22:15:20 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-01-08 22:15:20 +0000 |
commit | 5dabead1871ed0100674e3eeb4a9f549b1997a85 (patch) | |
tree | 224befd9530cbddacc71900bd29c71718506e70d /ext/psych | |
parent | 8c08c8298a03a01629a478b74abfd57d7f35cb05 (diff) | |
download | ruby-5dabead1871ed0100674e3eeb4a9f549b1997a85.tar.gz |
* 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
Diffstat (limited to 'ext/psych')
-rw-r--r-- | ext/psych/lib/psych/visitors/to_ruby.rb | 4 |
1 files changed, 2 insertions, 2 deletions
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) |