summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi SHIBATA <[email protected]>2024-10-16 17:41:56 +0900
committergit <[email protected]>2024-10-16 08:49:54 +0000
commit2bf9c82f1b8f2c6807e1c93cc660ea3cee45120a (patch)
tree506a12cc6559bea95a8969a308e7ecbef8723a9f
parentc1f6ad561bfb584ac9fc477f0855d087ce4bcd6d (diff)
[ruby/yaml] Support old version of Psych
https://github.com/ruby/yaml/commit/5b39653c52
-rw-r--r--lib/yaml/store.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/yaml/store.rb b/lib/yaml/store.rb
index 859621d271..27c823b9f9 100644
--- a/lib/yaml/store.rb
+++ b/lib/yaml/store.rb
@@ -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