Class: HTTP::Response::Inflater

Inherits:
Object
  • Object
show all
Defined in:
lib/http/response/inflater.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ Inflater

Returns a new instance of Inflater.


10
11
12
# File 'lib/http/response/inflater.rb', line 10

def initialize(connection)
  @connection = connection
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.


8
9
10
# File 'lib/http/response/inflater.rb', line 8

def connection
  @connection
end

Instance Method Details

#readpartial(*args) ⇒ Object


14
15
16
17
18
19
20
21
22
23
# File 'lib/http/response/inflater.rb', line 14

def readpartial(*args)
  chunk = @connection.readpartial(*args)
  if chunk
    chunk = zstream.inflate(chunk)
  elsif !zstream.closed?
    zstream.finish if zstream.total_in.positive?
    zstream.close
  end
  chunk
end