mirror of
https://github.com/discourse/discourse.git
synced 2026-08-13 06:25:11 -05:00
DEV: Fix YAML load in new Ruby (#19500)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user