Class: Pipe::Receiver
- Inherits:
-
EM::Connection
- Object
- EM::Connection
- Pipe::Receiver
- Defined in:
- lib/em-pipe-run.rb
Instance Attribute Summary collapse
-
#buffer ⇒ Object
Holds pipe output buffer.
Instance Method Summary collapse
-
#initialize(callback = nil) ⇒ Receiver
constructor
Constructor.
-
#receive_data(data) ⇒ Object
Receives data from pipe.
-
#unbind ⇒ Object
Action after terminating the connection.
Constructor Details
#initialize(callback = nil) ⇒ Receiver
Constructor.
42 43 44 45 |
# File 'lib/em-pipe-run.rb', line 42 def initialize(callback = nil) @callback = callback @buffer = "" end |
Instance Attribute Details
#buffer ⇒ Object
Holds pipe output buffer.
28 29 30 |
# File 'lib/em-pipe-run.rb', line 28 def buffer @buffer end |
Instance Method Details
#receive_data(data) ⇒ Object
Receives data from pipe.
52 53 54 |
# File 'lib/em-pipe-run.rb', line 52 def receive_data(data) @buffer << data end |
#unbind ⇒ Object
Action after terminating the connection. Calls callback.
60 61 62 63 64 |
# File 'lib/em-pipe-run.rb', line 60 def unbind if not @callback.nil? @callback.call(@buffer) end end |