Use select instead of flat_map.

This commit is contained in:
Markus Reiter 2023-04-03 20:47:15 +02:00 committed by GitHub
parent 6e5ab67838
commit cf3054526a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -126,7 +126,7 @@ module Homebrew
# Installers are sometimes contained within an `.app`, so try both.
installer_path = artifact.path
installer_path.ascend
.flat_map { |path| (path == installer_path || path.extname == ".app") ? [path] : [] }
.select { |path| path == installer_path || path.extname == ".app" }
.sort
else
[artifact.source.basename]