Class: Excavate::Extractors::ZipExtractor

Inherits:
Extractor
  • Object
show all
Defined in:
lib/excavate/extractors/zip_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



6
7
8
9
10
11
12
13
14
# File 'lib/excavate/extractors/zip_extractor.rb', line 6

def extract(target)
  Zip::File.open(@archive) do |zip_file|
    zip_file.each do |entry|
      path = File.join(target, entry.name)
      FileUtils.mkdir_p(File.dirname(path))
      entry.extract(path)
    end
  end
end