Method: Suvii::Extract::Zip#extract_to

Defined in:
lib/suvii/extract/zip.rb

#extract_to(destination) ⇒ String

Performs archive extraction.

Parameters:

  • destination (String)

    directory where the archive should be extracted.

Returns:

  • (String)

    destination.

Since:

  • 0.1.0



7
8
9
10
11
12
13
14
15
16
# File 'lib/suvii/extract/zip.rb', line 7

def extract_to(destination)
  ::Zip::File.open(source) do |zip_file|
    zip_file.each do |entry|
      path = path_with_stripped_components(entry.name)
      destination_file = File.join(destination, path)
      entry.extract(destination_file)
    end
  end
  destination
end