[rubygems/rubygems] Replaced empty hash to nil value in YAML

https://github.com/rubygems/rubygems/commit/8771fbf53d
This commit is contained in:
Hiroshi SHIBATA 2023-04-17 16:45:14 +09:00 committed by git
parent 7e537e9613
commit 364c2fea34

View File

@ -77,9 +77,24 @@ module Bundler
last_hash[last_empty_key].push(convert_to_ruby_value(val))
end
end
deep_transform_values_with_empty_hash!(res)
res
end
def deep_transform_values_with_empty_hash!(hash)
hash.transform_values! do |v|
if v.is_a?(Hash)
if v.empty?
nil
else
deep_transform_values_with_empty_hash!(v)
end
else
v
end
end
end
def convert_to_ruby_value(val)
if val.match?(/\A:(.*)\Z/)
val[1..-1].to_sym