summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-08-03 15:56:53 -0700
committerGitHub <noreply@github.com>2020-08-03 15:56:53 -0700
commit9ea3dbbd7dec0494c430f78419472f1fe15265a3 (patch)
treefa5a6f364c3a6f5e0f2fc94f49e3aa32d40a1e19 /lib
parent0e3e4ba243264a4e08c807cdd4c5450904b76f9b (diff)
parenta6fc05725e7eb9cc3284fd68b8a6985bf685c10e (diff)
downloadchef-9ea3dbbd7dec0494c430f78419472f1fe15265a3.tar.gz
Merge pull request #10247 from chef/rubocop_Performance_SortReverse
Use sort.reverse instead of sort { |a, b| b <=> a }
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/util/backup.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/chef/util/backup.rb b/lib/chef/util/backup.rb
index 547d4095a3..5728dcaedd 100644
--- a/lib/chef/util/backup.rb
+++ b/lib/chef/util/backup.rb
@@ -87,7 +87,7 @@ class Chef
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