Class: Champagne::Console

Inherits:
EventMachine::Connection
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

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

#streamObject

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

#unbindObject



17
18
19
# File 'lib/champagne.rb', line 17

def unbind
  stream.close
end