Sha256: 5089501a7d2ec2fd03ba77208bc944f5ab6f12bf12fae9e4b23721cb7b82ad7a

Contents?: true

Size: 607 Bytes

Versions: 34

Compression:

Stored size: 607 Bytes

Contents

# frozen_string_literal: true

require "forwardable"

module HTTPX
  class Buffer
    extend Forwardable

    def_delegator :@buffer, :<<

    def_delegator :@buffer, :to_s

    def_delegator :@buffer, :to_str

    def_delegator :@buffer, :empty?

    def_delegator :@buffer, :bytesize

    def_delegator :@buffer, :clear

    def_delegator :@buffer, :replace

    attr_reader :limit

    def initialize(limit)
      @buffer = "".b
      @limit = limit
    end

    def full?
      @buffer.bytesize >= @limit
    end

    def shift!(fin)
      @buffer = @buffer.byteslice(fin..-1) || "".b
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
httpx-0.22.5 lib/httpx/buffer.rb
httpx-0.22.4 lib/httpx/buffer.rb
httpx-0.22.3 lib/httpx/buffer.rb
httpx-0.22.2 lib/httpx/buffer.rb
httpx-0.22.1 lib/httpx/buffer.rb
httpx-0.22.0 lib/httpx/buffer.rb
httpx-0.21.1 lib/httpx/buffer.rb
httpx-0.21.0 lib/httpx/buffer.rb
httpx-0.20.5 lib/httpx/buffer.rb
httpx-0.20.4 lib/httpx/buffer.rb
httpx-0.20.3 lib/httpx/buffer.rb
httpx-0.20.2 lib/httpx/buffer.rb
httpx-0.20.1 lib/httpx/buffer.rb
httpx-0.20.0 lib/httpx/buffer.rb
httpx-0.19.8 lib/httpx/buffer.rb
httpx-0.19.7 lib/httpx/buffer.rb
httpx-0.19.6 lib/httpx/buffer.rb
httpx-0.19.5 lib/httpx/buffer.rb
httpx-0.19.4 lib/httpx/buffer.rb
httpx-0.19.3 lib/httpx/buffer.rb