Skip to content

Commit a3c9b6b

Browse files
committed
Use max_by to determine the maximum value
This gives the same result, but it's much easier to read what's going on.
1 parent a0eb4d5 commit a3c9b6b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/rspec-puppet-facts.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ def self.facter_version_for_puppet_version(puppet_version)
412412
return Facter.version
413413
end
414414

415-
applicable_versions.sort { |a, b| b.first <=> a.first }.first.last
415+
applicable_versions.max_by { |p, _| p }.last
416416
rescue JSON::ParserError
417417
warning "#{json_path} contains invalid JSON, defaulting to Facter #{Facter.version}"
418418
Facter.version

0 commit comments

Comments
 (0)