Skip to content

Commit

Permalink
Merge pull request #181 from ekohl/use-max_by
Browse files Browse the repository at this point in the history
Use max_by to determine the maximum value
  • Loading branch information
bastelfreak committed Jun 9, 2024
2 parents 50cff16 + a3c9b6b commit bf7b684
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rspec-puppet-facts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ def self.facter_version_for_puppet_version(puppet_version)
return Facter.version
end

applicable_versions.sort { |a, b| b.first <=> a.first }.first.last
applicable_versions.max_by { |p, _| p }.last
rescue JSON::ParserError
warning "#{json_path} contains invalid JSON, defaulting to Facter #{Facter.version}"
Facter.version
Expand Down

0 comments on commit bf7b684

Please sign in to comment.