Sha256: 467462501bc9fae9a74696c70f6ee7372dac30e9453e216e039a1304d963e92a

Contents?: true

Size: 702 Bytes

Versions: 12

Compression:

Stored size: 702 Bytes

Contents

# frozen_string_literal: true

module HTTP
  class Response
    class Streamer
      def initialize(str, encoding: Encoding::BINARY)
        @io = StringIO.new str
        @encoding = encoding
      end

      def readpartial(size = nil, outbuf = nil)
        unless size
          if defined?(HTTP::Client::BUFFER_SIZE)
            size = HTTP::Client::BUFFER_SIZE
          elsif defined?(HTTP::Connection::BUFFER_SIZE)
            size = HTTP::Connection::BUFFER_SIZE
          end
        end

        chunk = @io.read size, outbuf
        chunk.force_encoding(@encoding) if chunk
      end

      def close
        @io.close
      end

      def sequence_id
        -1
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 4 rubygems

Version Path
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/webmock-3.23.1/lib/webmock/http_lib_adapters/http_rb/streamer.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/webmock-3.23.1/lib/webmock/http_lib_adapters/http_rb/streamer.rb
webmock-3.23.0 lib/webmock/http_lib_adapters/http_rb/streamer.rb
webmock-3.22.0 lib/webmock/http_lib_adapters/http_rb/streamer.rb
webmock-3.21.2 lib/webmock/http_lib_adapters/http_rb/streamer.rb
webmock-3.21.1 lib/webmock/http_lib_adapters/http_rb/streamer.rb
webmock-3.21.0 lib/webmock/http_lib_adapters/http_rb/streamer.rb
webmock-3.20.0 lib/webmock/http_lib_adapters/http_rb/streamer.rb
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/webmock-3.19.1/lib/webmock/http_lib_adapters/http_rb/streamer.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/webmock-3.19.1/lib/webmock/http_lib_adapters/http_rb/streamer.rb
webmock-3.19.1 lib/webmock/http_lib_adapters/http_rb/streamer.rb
webmock-3.19.0 lib/webmock/http_lib_adapters/http_rb/streamer.rb