Skip to content

Commit

Permalink
Support psych < 3.1.0 YAML.safe_load calling conventions for ruby < 2…
Browse files Browse the repository at this point in the history
….6 (issue #319).
  • Loading branch information
postmodern committed Aug 31, 2021
1 parent 18da030 commit 8a3a197
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/bundler/audit/advisory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ class Advisory < Struct.new(:path,
def self.load(path)
id = File.basename(path).chomp('.yml')
data = File.open(path) do |yaml|
YAML.safe_load(yaml, permitted_classes: [Date])
if Psych::VERSION >= '3.1.0'
YAML.safe_load(yaml, permitted_classes: [Date])
else
# XXX: psych < 3.1.0 YAML.safe_load calling convention
YAML.safe_load(yaml, [Date])
end
end

unless data.kind_of?(Hash)
Expand Down

0 comments on commit 8a3a197

Please sign in to comment.