Class: Terminalwire::V2::Server::Context::RawInput
- Inherits:
-
Object
- Object
- Terminalwire::V2::Server::Context::RawInput
- Defined in:
- lib/terminalwire/v2/server/context.rb
Overview
Reads keystroke chunks from a raw input stream. #read returns the next chunk (or nil when the stream closes); #each yields until close.
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(runtime, sid) ⇒ RawInput
constructor
A new instance of RawInput.
- #read ⇒ Object
Constructor Details
#initialize(runtime, sid) ⇒ RawInput
Returns a new instance of RawInput.
165 166 167 168 |
# File 'lib/terminalwire/v2/server/context.rb', line 165 def initialize(runtime, sid) @runtime = runtime @sid = sid end |
Instance Method Details
#each ⇒ Object
172 173 174 175 176 177 178 |
# File 'lib/terminalwire/v2/server/context.rb', line 172 def each return enum_for(:each) unless block_given? while (bytes = read) yield bytes end end |
#read ⇒ Object
170 |
# File 'lib/terminalwire/v2/server/context.rb', line 170 def read = @runtime.read_raw(@sid) |