Class: GryphonNest::Compressors::GzipCompressor
- Inherits:
-
Object
- Object
- GryphonNest::Compressors::GzipCompressor
- Defined in:
- lib/gryphon_nest/compressors/gzip_compressor.rb
Instance Method Summary collapse
Instance Method Details
#compress(file) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/gryphon_nest/compressors/gzip_compressor.rb', line 13 def compress(file) compressed = "#{file}#{extname}" Zlib::GzipWriter.open(compressed, Zlib::BEST_COMPRESSION) do |gz| gz.mtime = file.mtime gz.orig_name = file.to_s gz.write IO.binread(file) end end |
#extname ⇒ Object
8 9 10 |
# File 'lib/gryphon_nest/compressors/gzip_compressor.rb', line 8 def extname '.gz' end |