Sha256: ff64267d5d0474f25f252006fd18cdead7894d3a1b8cf3a5b4e2161d15ca3d41

Contents?: true

Size: 610 Bytes

Versions: 15

Compression:

Stored size: 610 Bytes

Contents

require "zip"

module Fontist
  module Import
    module Extractors
      class ZipExtractor < Extractor
        def extract
          dir = Dir.mktmpdir
          extract_zip(@archive, dir)
          dir
        end

        def format
          "zip"
        end

        private

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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
fontist-1.8.7 lib/fontist/import/extractors/zip_extractor.rb
fontist-1.8.6 lib/fontist/import/extractors/zip_extractor.rb
fontist-1.8.5 lib/fontist/import/extractors/zip_extractor.rb
fontist-1.8.4 lib/fontist/import/extractors/zip_extractor.rb
fontist-1.8.3 lib/fontist/import/extractors/zip_extractor.rb
fontist-1.8.2 lib/fontist/import/extractors/zip_extractor.rb
fontist-1.8.1 lib/fontist/import/extractors/zip_extractor.rb
fontist-1.7.3 lib/fontist/import/extractors/zip_extractor.rb
fontist-1.7.2 lib/fontist/import/extractors/zip_extractor.rb
fontist-1.7.1 lib/fontist/import/extractors/zip_extractor.rb
fontist-1.7.0 lib/fontist/import/extractors/zip_extractor.rb
fontist-1.6.0 lib/fontist/import/extractors/zip_extractor.rb
fontist-1.5.1 lib/fontist/import/extractors/zip_extractor.rb
fontist-1.5.0 lib/fontist/import/extractors/zip_extractor.rb
fontist-1.4.0 lib/fontist/import/extractors/zip_extractor.rb