Class: HTTP2::Buffer
- Inherits:
-
String
- Object
- String
- HTTP2::Buffer
- Defined in:
- lib/http/2/buffer.rb
Overview
Simple binary buffer backed by string.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Buffer
constructor
Forces binary encoding on the string.
-
#read(n) ⇒ Object
Emulate StringIO#read: slice first n bytes from the buffer.
Constructor Details
#initialize(*args) ⇒ Buffer
Forces binary encoding on the string
8 9 10 11 |
# File 'lib/http/2/buffer.rb', line 8 def initialize(*args) force_encoding('binary') super(*args) end |
Instance Method Details
#read(n) ⇒ Object
Emulate StringIO#read: slice first n bytes from the buffer.
16 17 18 |
# File 'lib/http/2/buffer.rb', line 16 def read(n) slice!(0,n) end |