Class: WebSocket::Driver::Hybi::StreamReader
- Inherits:
-
Object
- Object
- WebSocket::Driver::Hybi::StreamReader
- Defined in:
- lib/websocket/driver/hybi/stream_reader.rb
Instance Method Summary collapse
-
#initialize ⇒ StreamReader
constructor
A new instance of StreamReader.
- #put(bytes) ⇒ Object
- #read(length) ⇒ Object
Constructor Details
#initialize ⇒ StreamReader
Returns a new instance of StreamReader.
6 7 8 |
# File 'lib/websocket/driver/hybi/stream_reader.rb', line 6 def initialize @queue = [] end |
Instance Method Details
#put(bytes) ⇒ Object
14 15 16 17 |
# File 'lib/websocket/driver/hybi/stream_reader.rb', line 14 def put(bytes) return unless bytes and bytes.size > 0 @queue.concat(bytes) end |
#read(length) ⇒ Object
10 11 12 |
# File 'lib/websocket/driver/hybi/stream_reader.rb', line 10 def read(length) read_bytes(length) end |