lib/httpx/plugins/compression/brotli.rb in httpx-0.9.0 vs lib/httpx/plugins/compression/brotli.rb in httpx-0.10.0
- old
+ new
@@ -11,11 +11,11 @@
def self.configure(*)
Compression.register "br", self
end
- module Encoder
+ module Deflater
module_function
def deflate(raw, buffer, chunk_size:)
while (chunk = raw.read(chunk_size))
compressed = ::Brotli.deflate(chunk)
@@ -23,31 +23,27 @@
yield compressed if block_given?
end
end
end
- module BrotliWrapper
- module_function
-
- def inflate(text)
- ::Brotli.inflate(text)
+ class Inflater
+ def initialize(bytesize)
+ @bytesize = bytesize
end
- def close; end
-
- def finish
- ""
+ def inflate(chunk)
+ ::Brotli.inflate(chunk)
end
end
module_function
- def encoder
- Encoder
+ def deflater
+ Deflater
end
- def decoder
- Decoder.new(BrotliWrapper)
+ def inflater(bytesize)
+ Inflater.new(bytesize)
end
end
end
register_plugin :"compression/brotli", Compression::Brotli
end