[ruby/yaml] Support old version of Psych

https://github.com/ruby/yaml/commit/5b39653c52
This commit is contained in:
Hiroshi SHIBATA 2024-10-16 17:41:56 +09:00 committed by git
parent c1f6ad561b
commit 2bf9c82f1b

View File

@ -69,7 +69,15 @@ class YAML::Store < PStore
end
def load(content)
table = YAML.respond_to?(:safe_load) ? YAML.safe_load(content, permitted_classes: [Symbol]) : YAML.load(content)
table = if YAML.respond_to?(:safe_load)
if Psych::VERSION >= "3.1"
YAML.safe_load(content, permitted_classes: [Symbol])
else
YAML.safe_load(content, [Symbol])
end
else
YAML.load(content)
end
if table == false || table == nil
{}
else