Modify syntax for readability / consistency

leverage map block and guard clause for readability thx @MikeMcQuaid
This commit is contained in:
Benjamin Bolton 2021-09-07 10:10:26 -06:00
parent a83877660b
commit dce6b77ad0
No known key found for this signature in database
GPG Key ID: ABB6056A88EDCCB9

View File

@ -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