Use a case statement in Pathname#compression_type

This commit is contained in:
Jack Nagel 2014-04-06 11:18:25 -05:00
parent e9e5ad8d31
commit 607605dd8f

View File

@ -202,16 +202,18 @@ class Pathname
end end
def compression_type def compression_type
# Don't treat jars or wars as compressed case extname
return nil if self.extname == '.jar' when ".jar", ".war"
return nil if self.extname == '.war' # Don't treat jars or wars as compressed
return
# OS X installer package when ".pkg"
return :pkg if self.extname == '.pkg' # OS X installer package
return :pkg
# If the filename ends with .gz not preceded by .tar when ".gz"
# then we want to gunzip but not tar # If the filename ends with .gz not preceded by .tar
return :gzip_only if self.extname == '.gz' # then we want to gunzip but not tar
return :gzip_only
end
# Get enough of the file to detect common file types # Get enough of the file to detect common file types
# POSIX tar magic has a 257 byte offset # POSIX tar magic has a 257 byte offset