class HTTPX::Transcoder::GZIP::Deflater

  1. lib/httpx/transcoder/gzip.rb
Superclass: Deflater

Methods

Public Class

  1. new

Public Instance

  1. deflate

Public Class methods

new(body)
[show source]
   # File lib/httpx/transcoder/gzip.rb
 9 def initialize(body)
10   @compressed_chunk = "".b
11   super
12 end

Public Instance methods

deflate(chunk)
[show source]
   # File lib/httpx/transcoder/gzip.rb
14 def deflate(chunk)
15   @deflater ||= Zlib::GzipWriter.new(self)
16 
17   if chunk.nil?
18     unless @deflater.closed?
19       @deflater.flush
20       @deflater.close
21       compressed_chunk
22     end
23   else
24     @deflater.write(chunk)
25     compressed_chunk
26   end
27 end