diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-04-17 13:23:48 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-04-17 13:23:48 -0700 |
commit | 0a18d2aab1b78e2ddf9ce173cc89e496af7d95e1 (patch) | |
tree | ba1732efe914e56b37db8d0c0101d143b55b3345 | |
parent | 19b2a0ebdabc673ff3c30fcdb1d9df26b449c20d (diff) | |
download | chef-0a18d2aab1b78e2ddf9ce173cc89e496af7d95e1.tar.gz |
Use .map.compact instead of filter_map to support ruby 2.6
I left a note to kill this later
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | lib/chef/provider/package/homebrew.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/chef/provider/package/homebrew.rb b/lib/chef/provider/package/homebrew.rb index a650c1202d..fed1046789 100644 --- a/lib/chef/provider/package/homebrew.rb +++ b/lib/chef/provider/package/homebrew.rb @@ -63,8 +63,9 @@ class Chef # and which packages can be upgrades. We do this by checking if brew_info has an entry # via the installed_version helper. def upgrade_package(names, versions) - upgrade_pkgs = names.filter_map { |x| x if installed_version(x) } - install_pkgs = names.filter_map { |x| x unless installed_version(x) } + # @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 brew_cmd_output("upgrade", options, upgrade_pkgs) unless upgrade_pkgs.empty? brew_cmd_output("install", options, install_pkgs) unless install_pkgs.empty? |