Class: RubyXL::MyZip

Inherits:
Object
  • Object
show all
Defined in:
lib/rubyXL/zip.rb

Instance Method Summary collapse

Instance Method Details

#unzip(zipPath, zipDirPath) ⇒ Object

Unzips .zip file at zipPath to zipDirPath



9
10
11
12
13
14
15
16
17
# File 'lib/rubyXL/zip.rb', line 9

def unzip(zipPath,zipDirPath)
  Zip::ZipFile.open(zipPath) { |zip_file|
    zip_file.each { |f|
      fpath = File.join(zipDirPath, f.name)
      FileUtils.mkdir_p(File.dirname(fpath))
      zip_file.extract(f, fpath) unless File.exist?(fpath)
    }
  }
end