summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-04-17 13:25:07 -0700
committerTim Smith <tsmith84@gmail.com>2020-04-17 13:25:07 -0700
commit3095f093a248695b6550f915eb7a91678a881e5f (patch)
tree31f802f36a0be6e8771d2daca7987abfc415dee0
parent0a18d2aab1b78e2ddf9ce173cc89e496af7d95e1 (diff)
downloadchef-3095f093a248695b6550f915eb7a91678a881e5f.tar.gz
Use select instead of map
It makes more sense when you read it Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/provider/package/homebrew.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/chef/provider/package/homebrew.rb b/lib/chef/provider/package/homebrew.rb
index fed1046789..1677c1a3dc 100644
--- a/lib/chef/provider/package/homebrew.rb
+++ b/lib/chef/provider/package/homebrew.rb
@@ -64,8 +64,8 @@ class Chef
# via the installed_version helper.
def upgrade_package(names, versions)
# @todo when we no longer support Ruby 2.6 this can be simplified to be a .filter_map
- upgrade_pkgs = names.map { |x| x if installed_version(x) }.compact
- install_pkgs = names.map { |x| x unless installed_version(x) }.compact
+ upgrade_pkgs = names.select { |x| x if installed_version(x) }.compact
+ install_pkgs = names.select { |x| x unless installed_version(x) }.compact
brew_cmd_output("upgrade", options, upgrade_pkgs) unless upgrade_pkgs.empty?
brew_cmd_output("install", options, install_pkgs) unless install_pkgs.empty?