Class: Excavate::Extractors::GzipExtractor

Inherits:
Extractor
  • Object
show all
Defined in:
lib/excavate/extractors/gzip_extractor.rb

Instance Method Summary collapse

Methods inherited from Extractor

#initialize

Constructor Details

This class inherits a constructor from Excavate::Extractors::Extractor

Instance Method Details

#extract(target) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/excavate/extractors/gzip_extractor.rb', line 4

def extract(target)
  Zlib::GzipReader.open(@archive) do |gz|
    basename = File.basename(@archive, ".*")
    path = File.join(target, basename)
    File.write(path, gz.read, mode: "wb")
  end
end