Class: EventMachine::HttpDecoders::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/em-http/decoders.rb

Direct Known Subclasses

Deflate, GZip

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&chunk_callback) ⇒ Base

chunk_callback
Block

To handle a decompressed chunk



31
32
33
# File 'lib/em-http/decoders.rb', line 31

def initialize(&chunk_callback)
  @chunk_callback = chunk_callback
end

Class Method Details

.encoding_namesObject



24
25
26
27
# File 'lib/em-http/decoders.rb', line 24

def self.encoding_names
  name = to_s.split('::').last.downcase
  [name]
end

Instance Method Details

#<<(compressed) ⇒ Object



35
36
37
38
39
40
# File 'lib/em-http/decoders.rb', line 35

def <<(compressed)
  return unless compressed && compressed.size > 0

  decompressed = decompress(compressed)
  receive_decompressed decompressed
end

#finalize!Object



42
43
44
45
# File 'lib/em-http/decoders.rb', line 42

def finalize!
  decompressed = finalize
  receive_decompressed decompressed
end