Class: Champagne::Console
- Inherits:
-
EventMachine::Connection
- Object
- EventMachine::Connection
- Champagne::Console
- Defined in:
- lib/champagne.rb
Overview
Open up a connecton to console and stream the output. When the process is killed, we shut down the stream.
Instance Attribute Summary collapse
-
#stream ⇒ Object
Returns the value of attribute stream.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(stream) ⇒ Console
constructor
A new instance of Console.
- #receive_data(data) ⇒ Object
- #unbind ⇒ Object
Constructor Details
#initialize(stream) ⇒ Console
Returns a new instance of Console.
9 10 11 |
# File 'lib/champagne.rb', line 9 def initialize(stream) @stream = stream end |
Instance Attribute Details
#stream ⇒ Object
Returns the value of attribute stream.
7 8 9 |
# File 'lib/champagne.rb', line 7 def stream @stream end |
Class Method Details
.exec(cmd, stream) ⇒ Object
21 22 23 |
# File 'lib/champagne.rb', line 21 def self.exec(cmd, stream) EM.popen cmd, self, stream end |
Instance Method Details
#receive_data(data) ⇒ Object
13 14 15 |
# File 'lib/champagne.rb', line 13 def receive_data(data) stream << data end |
#unbind ⇒ Object
17 18 19 |
# File 'lib/champagne.rb', line 17 def unbind stream.close end |