Sha256: fc18a25f1fcd21ca061e93240079c1411db35e1c515abe107e3b112c716c1d58
Contents?: true
Size: 726 Bytes
Versions: 1
Compression:
Stored size: 726 Bytes
Contents
require_relative 'deflater_base' module Paperclip module Processors class Gzip < DeflaterBase def initialize(file, options = {}, attachment = nil) super @gzip_options = @options[:gzip_options] || {} end def make level = @gzip_options[:level] strategy = @gzip_options[:strategy] dst = create_tempfile begin gz = Zlib::GzipWriter.new(dst, level, strategy) while chunk = @file.read(16 * 1024) do gz.write chunk end rescue ::Exception => e gz.close rescue nil raise e end gz.close @file.rewind dst.open dst end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
paperclip-deflater-0.1.3 | lib/paperclip/processors/gzip.rb |