Class: Pipe::Receiver
- Inherits:
-
EM::Connection
- Object
- EM::Connection
- Pipe::Receiver
- Defined in:
- lib/em-pipe-run.rb
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.
38 39 40 41 |
# File 'lib/em-pipe-run.rb', line 38 def initialize(callback = nil) @callback = callback @buffer = "" end |
Instance Method Details
#receive_data(data) ⇒ Object
Receives data from pipe.
48 49 50 |
# File 'lib/em-pipe-run.rb', line 48 def receive_data(data) @buffer << data end |
#unbind ⇒ Object
Action after terminating the connection. Calls callback.
56 57 58 59 60 |
# File 'lib/em-pipe-run.rb', line 56 def unbind if not @callback.nil? @callback.call(@buffer) end end |