summaryrefslogtreecommitdiff
path: root/lib/chef/run_context/cookbook_compiler.rb
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-07-06 18:02:40 -0700
committerTim Smith <tsmith84@gmail.com>2020-07-06 18:02:40 -0700
commitd2263f56a47c546367d04e0e85712c211484a62a (patch)
tree26fb4c599e61e89a883c905eee9f43978b7959d3 /lib/chef/run_context/cookbook_compiler.rb
parent873f8592c06235e2102745de87f976c33be06709 (diff)
downloadchef-perf.tar.gz
Misc perf offenses from rubocop-performanceperf
A few pretty obvious ones that avoid returning large data sets that we then search for the data we want. Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef/run_context/cookbook_compiler.rb')
-rw-r--r--lib/chef/run_context/cookbook_compiler.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/chef/run_context/cookbook_compiler.rb b/lib/chef/run_context/cookbook_compiler.rb
index 9d8ea87360..e1e4c215ad 100644
--- a/lib/chef/run_context/cookbook_compiler.rb
+++ b/lib/chef/run_context/cookbook_compiler.rb
@@ -325,7 +325,7 @@ class Chef
def count_files_by_segment(segment, root_alias = nil)
cookbook_collection.inject(0) do |count, cookbook_by_name|
- count + cookbook_by_name[1].segment_filenames(segment).size + (root_alias ? cookbook_by_name[1].files_for(:root_files).select { |record| record[:name] == root_alias }.size : 0)
+ count + cookbook_by_name[1].segment_filenames(segment).size + (root_alias ? cookbook_by_name[1].files_for(:root_files).count { |record| record[:name] == root_alias } : 0)
end
end