Class: HTTPX::Buffer
- Inherits:
-
Object
- Object
- HTTPX::Buffer
- Extended by:
- Forwardable
- Defined in:
- lib/httpx/buffer.rb
Instance Attribute Summary collapse
-
#limit ⇒ Object
readonly
Returns the value of attribute limit.
Instance Method Summary collapse
- #full? ⇒ Boolean
-
#initialize(limit) ⇒ Buffer
constructor
A new instance of Buffer.
- #shift!(fin) ⇒ Object
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
#limit ⇒ Object (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
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 |