Class: HTTPX::Transcoder::Inflater

Inherits:
Object
  • Object
show all
Defined in:
lib/httpx/transcoder/utils/inflater.rb

Instance Method Summary collapse

Constructor Details

#initialize(bytesize) ⇒ Inflater

Returns a new instance of Inflater.



6
7
8
# File 'lib/httpx/transcoder/utils/inflater.rb', line 6

def initialize(bytesize)
  @bytesize = bytesize
end

Instance Method Details

#call(chunk) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/httpx/transcoder/utils/inflater.rb', line 10

def call(chunk)
  buffer = @inflater.inflate(chunk)
  @bytesize -= chunk.bytesize
  if @bytesize <= 0
    buffer << @inflater.finish
    @inflater.close
  end
  buffer
end