mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
parent
c1f6ad561b
commit
2bf9c82f1b
1 changed files with 9 additions and 1 deletions
|
@ -69,7 +69,15 @@ class YAML::Store < PStore
|
||||||
end
|
end
|
||||||
|
|
||||||
def load(content)
|
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
|
if table == false || table == nil
|
||||||
{}
|
{}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue