summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-08-03 18:50:36 -0700
committerTim Smith <tsmith84@gmail.com>2020-08-03 18:50:36 -0700
commite044284d5b8cfb935ee1036afd7e08536a9d611b (patch)
treef6652d31cb7d9e7970ee6d854fa22955666cae89 /lib
parenteaa8f924bbe2d1c2c9f4d1073bca7d2fa8a15140 (diff)
downloadchef-e044284d5b8cfb935ee1036afd7e08536a9d611b.tar.gz
Use find instead of select.firstrubocop_Performance_Detect
Avoid creating an object only to select the first Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/provider/package/rubygems.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/chef/provider/package/rubygems.rb b/lib/chef/provider/package/rubygems.rb
index be4f1a149c..0f2c236166 100644
--- a/lib/chef/provider/package/rubygems.rb
+++ b/lib/chef/provider/package/rubygems.rb
@@ -188,7 +188,7 @@ class Chef
# Use the API that 'gem install' calls which does not pull down the rubygems universe
begin
rs = dependency_installer.resolve_dependencies gem_dependency.name, gem_dependency.requirement
- rs.specs.select { |s| s.name == gem_dependency.name }.first
+ rs.specs.find { |s| s.name == gem_dependency.name }
rescue Gem::UnsatisfiableDependencyError
nil
end