Skip to content

Commit

Permalink
Use named parameters for safe_load.
Browse files Browse the repository at this point in the history
This is available since Psych 3.1 [[1], [2]], but mandatory since Psych
4.0 [[3]].

Fixes jnunemaker#72

[1]: ruby/psych#358
[2]: ruby/psych#378
[3]: ruby/psych@0767227
  • Loading branch information
voxik committed Mar 11, 2022
1 parent a951228 commit 7fa8d8a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/crack/json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def self.parser_exceptions

def self.parse(json)
yaml = unescape(convert_json_to_yaml(json))
YAML.safe_load(yaml, [Regexp, Date, Time])
YAML.safe_load(yaml, permitted_classes: [Regexp, Date, Time])
rescue *parser_exceptions
raise ParseError, "Invalid JSON string"
rescue Psych::DisallowedClass
Expand Down

0 comments on commit 7fa8d8a

Please sign in to comment.