From 12a0c281ea6dca7e2e0f7e10be2b2900c3d086e9 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 16 Jul 2019 21:10:21 +0100 Subject: [PATCH] cask/cmd/info: fix brew style, refactor. --- Library/Homebrew/cask/cmd/info.rb | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/Library/Homebrew/cask/cmd/info.rb b/Library/Homebrew/cask/cmd/info.rb index bfe4840703..a09291bce0 100644 --- a/Library/Homebrew/cask/cmd/info.rb +++ b/Library/Homebrew/cask/cmd/info.rb @@ -59,23 +59,19 @@ module Cask end def self.installation_info(cask) + return "Not installed\n" unless cask.installed? + install_info = +"" - if cask.installed? - cask.versions.each do |version| - versioned_staged_path = cask.caskroom_path.join(version) - install_info << versioned_staged_path.to_s - .concat(" (") - .concat( - if versioned_staged_path.exist? - then versioned_staged_path.abv - else Formatter.error("does not exist") - end, - ).concat(")\n") + cask.versions.each do |version| + versioned_staged_path = cask.caskroom_path.join(version) + path_details = if versioned_staged_path.exist? + versioned_staged_path.abv + else + Formatter.error("does not exist") end - install_info.freeze - else - "Not installed\n" + install_info << "#{versioned_staged_path} (#{path_details})\n" end + install_info.freeze end def self.name_info(cask)