123456789_123456789_123456789_123456789_123456789_

Module: Sprockets::Utils::Gzip::ZlibArchiver

Relationships & Source Files
Defined in: lib/sprockets/utils/gzip.rb

Overview

Private: Generates a gzipped file based off of reference asset.

ZlibArchiver.call(file, source, mtime)

Compresses a given #source using stdlib Zlib algorithm writes contents to the file passed in. Sets mtime of written file to passed in mtime

Class Method Summary

Class Method Details

.call(file, source, mtime)

[ GitHub ]

  
# File 'lib/sprockets/utils/gzip.rb', line 13

def self.call(file, source, mtime)
  gz = Zlib::GzipWriter.new(file, Zlib::BEST_COMPRESSION)
  gz.mtime = mtime
  gz.write(source)
  gz.close

  File.utime(mtime, mtime, file.path)
end