class Async::HTTP::Body::ZStream
def self.encoding_name(window_size)
def self.encoding_name(window_size) if window_size <= -8 return 'deflate' elsif window_size >= 16 return 'gzip' else return 'compress' end end
def initialize(body, stream)
def initialize(body, stream) super(body) @stream = stream @input_size = 0 @output_size = 0 end
def inspect
def inspect "#{super} | \#<#{self.class} #{(ratio*100).round(2)}%>" end
def ratio
def ratio @output_size.to_f / @input_size.to_f end
def stop(error)
def stop(error) # There are two ways for the stream to be closed. Either #read returns nil or #stop is called. @stream.close unless @stream.closed? super end