Class: HTTPX::Plugins::Brotli::Deflater

Inherits:
Transcoder::Deflater show all
Defined in:
lib/httpx/plugins/brotli.rb

Instance Attribute Summary

Attributes inherited from Transcoder::Deflater

#content_type

Instance Method Summary collapse

Methods inherited from Transcoder::Deflater

#bytesize, #close, #read, #rewind

Constructor Details

#initialize(body) ⇒ Deflater

Returns a new instance of Deflater.



9
10
11
12
# File 'lib/httpx/plugins/brotli.rb', line 9

def initialize(body)
  @compressor = ::Brotli::Compressor.new
  super
end

Instance Method Details

#deflate(chunk) ⇒ Object



14
15
16
17
18
# File 'lib/httpx/plugins/brotli.rb', line 14

def deflate(chunk)
  return @compressor.process(chunk) << @compressor.flush if chunk

  @compressor.finish
end