Skip to content

Commit

Permalink
Merge pull request #10247 from chef/rubocop_Performance_SortReverse
Browse files Browse the repository at this point in the history
Use sort.reverse instead of sort { |a, b| b <=> a }
  • Loading branch information
tas50 authored Aug 3, 2020
2 parents 0e3e4ba + a6fc057 commit 9ea3dbb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/chef/util/backup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def unsorted_backup_files
end

def sorted_backup_files
unsorted_backup_files.sort { |a, b| b <=> a }
unsorted_backup_files.sort.reverse # faster than sort { |a, b| b <=> a }
end
end
end
Expand Down

0 comments on commit 9ea3dbb

Please sign in to comment.