Internal class to abstract a string buffer, by wrapping a string and providing the minimum possible API and functionality required.
buffer = Buffer.new(640) buffer.full? #=> false buffer << "aa" buffer.capacity #=> 638
Attributes
limit | [R] |
Public Class methods
new(limit)
[show source]
# File lib/httpx/buffer.rb 33 def initialize(limit) 34 @buffer = "".b 35 @limit = limit 36 end
Public Instance methods
capacity()
[show source]
# File lib/httpx/buffer.rb 42 def capacity 43 @limit - @buffer.bytesize 44 end
shift!(fin)
[show source]
# File lib/httpx/buffer.rb 46 def shift!(fin) 47 @buffer = @buffer.byteslice(fin..-1) || "".b 48 end