Sha256: 3e63b56c593956b494c7b794b5f197a3354b2227e4f1249c57cf56d3ffc190d1

Contents?: true

Size: 511 Bytes

Versions: 4

Compression:

Stored size: 511 Bytes

Contents

module Fontist
  module Utils
    module GzipExtractor
      def gzip_extract(resource)
        file = @downloaded ? resource : download_file(resource)

        extract_gzip_file(file)
      end

      private

      def extract_gzip_file(file)
        Zlib::GzipReader.open(file) do |gz|
          basename = File.basename(file, ".*")
          dir = Dir.mktmpdir
          path = File.join(dir, basename)
          File.write(path, gz.read, mode: "wb")

          path
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fontist-1.8.7 lib/fontist/utils/gzip_extractor.rb
fontist-1.8.6 lib/fontist/utils/gzip_extractor.rb
fontist-1.8.5 lib/fontist/utils/gzip_extractor.rb
fontist-1.8.4 lib/fontist/utils/gzip_extractor.rb