Merge pull request #42249 from byroot/psych-4-support

Fix compatibility with Psych 4
This commit is contained in:
Jean Boussier 2021-05-18 10:14:49 +02:00 committed by GitHub
commit 179d0a1f47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -19,7 +19,12 @@ module ActiveSupport
end
def parse(context: nil, **options)
YAML.load(render(context), **options) || {}
source = render(context)
begin
YAML.load(source, aliases: true, **options) || {}
rescue ArgumentError
YAML.load(source, **options) || {}
end
rescue Psych::SyntaxError => error
raise "YAML syntax error occurred while parsing #{@content_path}. " \
"Please note that YAML must be consistently indented using spaces. Tabs are not allowed. " \