Class: Faye::WebSocket::HybiParser::StreamReader
- Inherits:
-
Object
- Object
- Faye::WebSocket::HybiParser::StreamReader
- Defined in:
- lib/faye/websocket/hybi_parser/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/faye/websocket/hybi_parser/stream_reader.rb', line 6 def initialize @queue = [] end |
Instance Method Details
#put(bytes) ⇒ Object
14 15 16 17 |
# File 'lib/faye/websocket/hybi_parser/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/faye/websocket/hybi_parser/stream_reader.rb', line 10 def read(length) read_bytes(length) end |