From dce6b77ad05ce23850fecdafb007cd261108a30a Mon Sep 17 00:00:00 2001 From: Benjamin Bolton <7146063+benpbolton@users.noreply.github.com> Date: Tue, 7 Sep 2021 10:10:26 -0600 Subject: [PATCH] Modify syntax for readability / consistency leverage map block and guard clause for readability thx @MikeMcQuaid --- Library/Homebrew/extend/os/mac/caveats.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/extend/os/mac/caveats.rb b/Library/Homebrew/extend/os/mac/caveats.rb index 2a3f8a8029..7abc7655ad 100644 --- a/Library/Homebrew/extend/os/mac/caveats.rb +++ b/Library/Homebrew/extend/os/mac/caveats.rb @@ -37,9 +37,14 @@ class Caveats if f.plist_manual || f.service? command = if f.service? - f.service.command - .map { |arg| (arg =~ /\s/) ? "'#{arg}'" : arg } # wrap multi-word arguments in quotes - .join(" ") + f.service + .command + .map do |arg| + next arg unless arg.match?(/\s/) + + # quote multi-word arguments + "'#{arg}'" + end.join(" ") else f.plist_manual end