DEV: Fix YAML load in new Ruby (#19500)
This commit is contained in:
parent
b80765f1f4
commit
b8c1289c7a
|
@ -8,7 +8,7 @@ class SiteSettings::YamlLoader
|
|||
end
|
||||
|
||||
def load
|
||||
yaml = YAML.load_file(@file)
|
||||
yaml = load_yaml(@file)
|
||||
yaml.each_key do |category|
|
||||
yaml[category].each do |setting_name, hash|
|
||||
if hash.is_a?(Hash)
|
||||
|
@ -31,4 +31,14 @@ class SiteSettings::YamlLoader
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def load_yaml(path)
|
||||
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.1.0')
|
||||
YAML.load_file(path, aliases: true)
|
||||
else
|
||||
YAML.load_file(path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue