Class: Paperclip::Processors::Deflater
- Inherits:
-
DeflaterBase
- Object
- Paperclip::Processor
- DeflaterBase
- Paperclip::Processors::Deflater
- Defined in:
- lib/paperclip/processors/deflater.rb
Instance Method Summary collapse
-
#initialize(file, options = {}, attachment = nil) ⇒ Deflater
constructor
A new instance of Deflater.
- #make ⇒ Object
Constructor Details
#initialize(file, options = {}, attachment = nil) ⇒ Deflater
Returns a new instance of Deflater.
6 7 8 9 |
# File 'lib/paperclip/processors/deflater.rb', line 6 def initialize(file, = {}, = nil) super = [:deflate_options] || {} end |
Instance Method Details
#make ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/paperclip/processors/deflater.rb', line 11 def make level = [:level] window_bits = [:window_bits] memlevel = [:memlevel] strategy = [:strategy] dst = create_tempfile begin zd = Zlib::Deflate.new(level, window_bits, memlevel, strategy) dst.write zd.deflate(@file.read) ensure zd.close end @file.rewind dst.flush dst.rewind dst end |