summaryrefslogtreecommitdiff
path: root/ext/psych/lib
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2020-06-08 17:52:41 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-06-23 15:26:29 +0900
commit666c077691a5521cb82254911f0abb9575cac9a1 (patch)
tree93c714a941c35584cfa081a117b2be2b47f413ec /ext/psych/lib
parente9adc2f4208797cb506f67c3e2fdc7966a6748e5 (diff)
[ruby/psych] Fix anchor lookup with symbolized names
https://github.com/ruby/psych/commit/ef74fc01e2
Diffstat (limited to 'ext/psych/lib')
-rw-r--r--ext/psych/lib/psych/visitors/to_ruby.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/ext/psych/lib/psych/visitors/to_ruby.rb b/ext/psych/lib/psych/visitors/to_ruby.rb
index a922f90831..ec80701917 100644
--- a/ext/psych/lib/psych/visitors/to_ruby.rb
+++ b/ext/psych/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