From dca43851afb2c95c0c514cf80f99f6fa8a0510b5 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 16 Jul 2019 21:10:36 +0100 Subject: [PATCH] download_strategy: fix brew style, refactor. --- Library/Homebrew/download_strategy.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 467959f213..ac8225741f 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -66,13 +66,13 @@ class AbstractDownloadStrategy def chdir entries = Dir["*"] - case entries.length - when 0 then raise "Empty archive" - when 1 then begin - Dir.chdir entries.first - rescue - nil - end + raise "Empty archive" if entries.length.zero? + return if entries.length != 1 + + begin + Dir.chdir entries.first + rescue + nil end end private :chdir