Class: OutputWatcher
- Inherits:
-
Object
- Object
- OutputWatcher
- Defined in:
- lib/output_watcher.rb
Instance Attribute Summary collapse
-
#stderr ⇒ Object
readonly
Returns the value of attribute stderr.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
Instance Method Summary collapse
-
#initialize(command) ⇒ OutputWatcher
constructor
A new instance of OutputWatcher.
Constructor Details
#initialize(command) ⇒ OutputWatcher
Returns a new instance of OutputWatcher.
4 5 6 7 8 9 10 11 12 |
# File 'lib/output_watcher.rb', line 4 def initialize(command) @stderr = '' @stdout = '' Open3.popen3(command) do |stdin, stdout, stderr| stderr.each_line { |line| @stderr << line } stdout.each_line { |line| @stdout << line } end end |
Instance Attribute Details
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
2 3 4 |
# File 'lib/output_watcher.rb', line 2 def stderr @stderr end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
2 3 4 |
# File 'lib/output_watcher.rb', line 2 def stdout @stdout end |