diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-08-03 15:23:52 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-08-03 15:23:52 -0700 |
commit | a6fc05725e7eb9cc3284fd68b8a6985bf685c10e (patch) | |
tree | 92e17074dc12f054016a8df1d9a28a32ecbb4d1e | |
parent | 71088574e7b67850612c43e0804d00baa0984506 (diff) | |
download | chef-a6fc05725e7eb9cc3284fd68b8a6985bf685c10e.tar.gz |
Use sort.reverse instead of sort { |a, b| b <=> a }
It's faster. See https://github.com/rubocop-hq/rubocop-performance/pull/130
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | lib/chef/util/backup.rb | 2 |
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 |