summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2015-01-08 14:16:13 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2015-01-08 14:16:13 -0800
commitaf308f8307899cb9e1c0fffea4bce3110a1c3926 (patch)
treef62717d4ec479d6b522b0d56ae038633b8c22555 /lib
parent8f84ad0fc711a82a1040def861cb121e8985fd4c (diff)
downloadpsych-af308f8307899cb9e1c0fffea4bce3110a1c3926.zip
* 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 fixes #196
Diffstat (limited to 'lib')
-rw-r--r--lib/psych/visitors/to_ruby.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/psych/visitors/to_ruby.rb b/lib/psych/visitors/to_ruby.rb
index adf38a2..f353e9c 100644
--- a/lib/psych/visitors/to_ruby.rb
+++ b/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)