diff options
author | Jean Boussier <jean.boussier@gmail.com> | 2020-06-08 17:52:41 +0200 |
---|---|---|
committer | Jean Boussier <jean.boussier@gmail.com> | 2020-06-08 18:21:27 +0200 |
commit | ef74fc01e2a4cab9f7e60b9d9e4fd28d4631a7e6 (patch) | |
tree | 725f25a8053ec647a7b77322a12c402af5c26177 /lib | |
parent | c3e5cfc6658a0dcac9abb021625116a09419d2bc (diff) | |
download | psych-ef74fc01e2a4cab9f7e60b9d9e4fd28d4631a7e6.zip |
Fix anchor lookup with symbolized names
Diffstat (limited to 'lib')
-rw-r--r-- | lib/psych/visitors/to_ruby.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/psych/visitors/to_ruby.rb b/lib/psych/visitors/to_ruby.rb index a922f90..ec80701 100644 --- a/lib/psych/visitors/to_ruby.rb +++ b/lib/psych/visitors/to_ruby.rb @@ -337,18 +337,12 @@ module Psych list end - SHOVEL = '<<' def revive_hash hash, o o.children.each_slice(2) { |k,v| key = accept(k) - if @symbolize_names - key = key.to_sym - elsif !@freeze - key = deduplicate(key) - end val = accept(v) - if key == SHOVEL && k.tag != "tag:yaml.org,2002:str" + if key == '<<' && k.tag != "tag:yaml.org,2002:str" case v when Nodes::Alias, Nodes::Mapping begin @@ -370,6 +364,12 @@ module Psych hash[key] = val end else + if @symbolize_names + key = key.to_sym + elsif !@freeze + key = deduplicate(key) + end + hash[key] = val end |