Sha256: 2c114e0f8692ca1412aad2fd174757c246f772538ce587409fa82ebac6ec1c55
Contents?: true
Size: 709 Bytes
Versions: 8
Compression:
Stored size: 709 Bytes
Contents
# frozen_string_literal: true require "forwardable" module HTTPX::Transcoder module Chunker module_function class Encoder extend Forwardable def_delegator :@raw, :readpartial CRLF = "\r\n" def initialize(body) @raw = body end def each return enum_for(__method__) unless block_given? @raw.each do |chunk| yield "#{chunk.bytesize.to_s(16)}#{CRLF}#{chunk}#{CRLF}" end yield "0#{CRLF}#{CRLF}" end def respond_to_missing?(meth, *args) @raw.respond_to?(meth, *args) || super end end def encode(chunks) Encoder.new(chunks) end end register "chunker", Chunker end
Version data entries
8 entries across 8 versions & 1 rubygems