Module: EventMachine::HttpDecoders

Defined in:
lib/em-http/decoders.rb

Overview

Provides a unified callback interface to decompression libraries.

Defined Under Namespace

Classes: Base, DecoderError, Deflate, GZip

Constant Summary collapse

DECODERS =
[Deflate, GZip]

Class Method Summary collapse

Class Method Details

.accepted_encodingsObject



12
13
14
# File 'lib/em-http/decoders.rb', line 12

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

.decoder_for_encoding(encoding) ⇒ Object



16
17
18
19
20
21
# File 'lib/em-http/decoders.rb', line 16

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