From 2bf9c82f1b8f2c6807e1c93cc660ea3cee45120a Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Wed, 16 Oct 2024 17:41:56 +0900 Subject: [PATCH] [ruby/yaml] Support old version of Psych https://github.com/ruby/yaml/commit/5b39653c52 --- lib/yaml/store.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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