Use a case statement in Pathname#compression_type
This commit is contained in:
parent
e9e5ad8d31
commit
607605dd8f
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user