Module: Nanoc::Gzip

Includes:
Zlib
Included in:
Filter
Defined in:
lib/nanoc-gzip/version.rb,
lib/nanoc-gzip/gzip.rb

Defined Under Namespace

Classes: Filter

Constant Summary collapse

VERSION =
"0.2.4"

Instance Method Summary collapse

Instance Method Details

#gzip(content, level, strategy) ⇒ void

This method returns an undefined value.

Parameters:

  • content (String)

    The contents of a file.

  • level (Integer)

    The compression level. The default is 9 (Zlib::BEST_COMPRESSION).

  • strategy (Integer)

    The compression strategy. The default is 0 (Zlib::DEFAULT_STRATEGY).



22
23
24
25
26
# File 'lib/nanoc-gzip/gzip.rb', line 22

def gzip(content, level, strategy)
  level ||= BEST_COMPRESSION
  strategy ||= DEFAULT_STRATEGY
  GzipWriter.open(output_filename, level, strategy) { _1.write(content) }
end