Class: Vito::ConnectionOutput
- Inherits:
-
Object
- Object
- Vito::ConnectionOutput
- Defined in:
- lib/vito/output.rb
Instance Method Summary collapse
-
#initialize(stdin, stdout, stderr, thread) ⇒ ConnectionOutput
constructor
A new instance of ConnectionOutput.
- #result ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(stdin, stdout, stderr, thread) ⇒ ConnectionOutput
Returns a new instance of ConnectionOutput.
3 4 5 6 7 |
# File 'lib/vito/output.rb', line 3 def initialize(stdin, stdout, stderr, thread) @stdout = stdout @stderr = stderr @thread = thread.value end |
Instance Method Details
#result ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/vito/output.rb', line 13 def result if success? @result ||= @stdout .read .gsub(/(\n|\s){1,}\Z/, "") else @result ||= @stderr.read end end |
#success? ⇒ Boolean
9 10 11 |
# File 'lib/vito/output.rb', line 9 def success? @thread.exitstatus == 0 end |