diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-08-03 18:50:36 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-08-03 18:50:36 -0700 |
commit | e044284d5b8cfb935ee1036afd7e08536a9d611b (patch) | |
tree | f6652d31cb7d9e7970ee6d854fa22955666cae89 /lib | |
parent | eaa8f924bbe2d1c2c9f4d1073bca7d2fa8a15140 (diff) | |
download | chef-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.rb | 2 |
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 |