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



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

def initialize(&chunk_callback)
  @chunk_callback = chunk_callback
end

Class Method Details

.encoding_namesObject



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

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

Instance Method Details

#<<(compressed) ⇒ Object



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

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

  decompressed = decompress(compressed)
  receive_decompressed decompressed
end

#finalize!Object



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

def finalize!
  decompressed = finalize
  receive_decompressed decompressed
end