From 9b386e32e31dee2fa1f43218593e103e08b42fe1 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Sun, 6 Apr 2014 11:18:25 -0500 Subject: Use a case statement in Pathname#compression_type --- Library/Homebrew/extend/pathname.rb | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'Library/Homebrew/extend') diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index 2cd6db044..337afbfc9 100644 --- a/Library/Homebrew/extend/pathname.rb +++ b/Library/Homebrew/extend/pathname.rb @@ -202,16 +202,18 @@ class Pathname end def compression_type - # Don't treat jars or wars as compressed - return nil if self.extname == '.jar' - return nil if self.extname == '.war' - - # OS X installer package - return :pkg if self.extname == '.pkg' - - # If the filename ends with .gz not preceded by .tar - # then we want to gunzip but not tar - return :gzip_only if self.extname == '.gz' + case extname + when ".jar", ".war" + # Don't treat jars or wars as compressed + return + when ".pkg" + # OS X installer package + return :pkg + when ".gz" + # If the filename ends with .gz not preceded by .tar + # then we want to gunzip but not tar + return :gzip_only + end # Get enough of the file to detect common file types # POSIX tar magic has a 257 byte offset -- cgit v1.2.3