Class: ProcessExecuter::ResultWithCapture
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- ProcessExecuter::ResultWithCapture
- Defined in:
- lib/process_executer/result_with_capture.rb
Overview
A decorator for ProcessExecuter::Result that adds the following attributes:
stdout
: the captured stdout of the commandstderr
: the captured stderr of the command
Instance Attribute Summary collapse
-
#stderr_buffer ⇒ StringIO
readonly
The buffer used to capture stderr.
-
#stdout_buffer ⇒ StringIO
readonly
The buffer used to capture stdout.
Instance Method Summary collapse
-
#initialize(result, stdout_buffer:, stderr_buffer:) ⇒ ResultWithCapture
constructor
Create a new ResultWithCapture object.
-
#stderr ⇒ String
The captured stderr of the command.
-
#stdout ⇒ String
The captured stdout of the command.
Constructor Details
#initialize(result, stdout_buffer:, stderr_buffer:) ⇒ ResultWithCapture
Create a new ResultWithCapture object
32 33 34 35 36 |
# File 'lib/process_executer/result_with_capture.rb', line 32 def initialize(result, stdout_buffer:, stderr_buffer:) super(result) @stdout_buffer = stdout_buffer @stderr_buffer = stderr_buffer end |
Instance Attribute Details
#stderr_buffer ⇒ StringIO (readonly)
The buffer used to capture stderr
54 55 56 |
# File 'lib/process_executer/result_with_capture.rb', line 54 def stderr_buffer @stderr_buffer end |
#stdout_buffer ⇒ StringIO (readonly)
The buffer used to capture stdout
42 43 44 |
# File 'lib/process_executer/result_with_capture.rb', line 42 def stdout_buffer @stdout_buffer end |
Instance Method Details
#stderr ⇒ String
The captured stderr of the command
60 |
# File 'lib/process_executer/result_with_capture.rb', line 60 def stderr = @stderr_buffer.string |
#stdout ⇒ String
The captured stdout of the command
48 |
# File 'lib/process_executer/result_with_capture.rb', line 48 def stdout = @stdout_buffer.string |