Module: HttpDecoders

Defined in:
lib/http_decoders.rb,
lib/http_decoders/version.rb

Overview

Unified callback interface to decompression libraries.

Defined Under Namespace

Classes: Base, DecoderError, Deflate, GZip, GZipHeader

Constant Summary collapse

DECODERS =
[Deflate, GZip]
VERSION =
'0.1.0'.freeze

Class Method Summary collapse

Class Method Details

.accepted_encodingsObject



13
14
15
# File 'lib/http_decoders.rb', line 13

def accepted_encodings
  DECODERS.inject([]) { |r, d| r + d.encoding_names }
end

.decoder_for_encoding(encoding) ⇒ Object



17
18
19
20
21
22
# File 'lib/http_decoders.rb', line 17

def decoder_for_encoding(encoding)
  DECODERS.each { |d|
    return d if d.encoding_names.include? encoding
  }
  nil
end