Class: Gryphon::Compressors::GzipCompressor
- Inherits:
-
Object
- Object
- Gryphon::Compressors::GzipCompressor
- Defined in:
- lib/gryphon/compressors/gzip_compressor.rb
Overview
Class for compressing files using zlib
Instance Method Summary collapse
Instance Method Details
#compress(file) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/gryphon/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(File.binread(file)) end end |
#extname ⇒ String
10 |
# File 'lib/gryphon/compressors/gzip_compressor.rb', line 10 def extname = '.gz' |