Class: HTTPX::Buffer

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/httpx/buffer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(limit) ⇒ Buffer

Returns a new instance of Buffer.



25
26
27
28
# File 'lib/httpx/buffer.rb', line 25

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

Instance Attribute Details

#limitObject (readonly)

Returns the value of attribute limit.



23
24
25
# File 'lib/httpx/buffer.rb', line 23

def limit
  @limit
end

Instance Method Details

#full?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/httpx/buffer.rb', line 30

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

#shift!(fin) ⇒ Object



34
35
36
# File 'lib/httpx/buffer.rb', line 34

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