Sha256: aebcb1db4b75d4884b1eefdfeb77905f4b0afb12c15be5f95b513fdcd2a28e76

Contents?: true

Size: 599 Bytes

Versions: 36

Compression:

Stored size: 599 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)
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
httpx-0.10.1 lib/httpx/buffer.rb
httpx-0.10.0 lib/httpx/buffer.rb
httpx-0.9.0 lib/httpx/buffer.rb
httpx-0.8.2 lib/httpx/buffer.rb
httpx-0.8.1 lib/httpx/buffer.rb
httpx-0.8.0 lib/httpx/buffer.rb
httpx-0.7.0 lib/httpx/buffer.rb
httpx-0.6.7 lib/httpx/buffer.rb
httpx-0.6.6 lib/httpx/buffer.rb
httpx-0.6.5 lib/httpx/buffer.rb
httpx-0.6.4 lib/httpx/buffer.rb
httpx-0.6.3 lib/httpx/buffer.rb
httpx-0.6.2 lib/httpx/buffer.rb
httpx-0.6.1 lib/httpx/buffer.rb
httpx-0.6.0 lib/httpx/buffer.rb
httpx-0.5.1 lib/httpx/buffer.rb