download_strategy: fix brew style, refactor.

This commit is contained in:
Mike McQuaid 2019-07-16 21:10:36 +01:00
parent 12a0c281ea
commit dca43851af
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70

View File

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