Class: Taski::Execution::TaskOutputPipe
- Inherits:
-
Object
- Object
- Taski::Execution::TaskOutputPipe
- Defined in:
- lib/taski/execution/task_output_pipe.rb
Overview
Manages a single IO pipe for capturing task output Each task gets its own dedicated pipe for stdout capture
Instance Attribute Summary collapse
-
#read_io ⇒ Object
readonly
Returns the value of attribute read_io.
-
#task_class ⇒ Object
readonly
Returns the value of attribute task_class.
-
#write_io ⇒ Object
readonly
Returns the value of attribute write_io.
Instance Method Summary collapse
- #close ⇒ Object
- #close_read ⇒ Object
- #close_write ⇒ Object
- #closed? ⇒ Boolean
-
#initialize(task_class) ⇒ TaskOutputPipe
constructor
A new instance of TaskOutputPipe.
- #read_closed? ⇒ Boolean
- #write_closed? ⇒ Boolean
Constructor Details
#initialize(task_class) ⇒ TaskOutputPipe
Returns a new instance of TaskOutputPipe.
10 11 12 13 14 |
# File 'lib/taski/execution/task_output_pipe.rb', line 10 def initialize(task_class) @task_class = task_class @read_io, @write_io = IO.pipe @write_io.sync = true end |
Instance Attribute Details
#read_io ⇒ Object (readonly)
Returns the value of attribute read_io.
8 9 10 |
# File 'lib/taski/execution/task_output_pipe.rb', line 8 def read_io @read_io end |
#task_class ⇒ Object (readonly)
Returns the value of attribute task_class.
8 9 10 |
# File 'lib/taski/execution/task_output_pipe.rb', line 8 def task_class @task_class end |
#write_io ⇒ Object (readonly)
Returns the value of attribute write_io.
8 9 10 |
# File 'lib/taski/execution/task_output_pipe.rb', line 8 def write_io @write_io end |
Instance Method Details
#close ⇒ Object
24 25 26 27 |
# File 'lib/taski/execution/task_output_pipe.rb', line 24 def close close_write close_read end |
#close_read ⇒ Object
20 21 22 |
# File 'lib/taski/execution/task_output_pipe.rb', line 20 def close_read @read_io.close unless @read_io.closed? end |
#close_write ⇒ Object
16 17 18 |
# File 'lib/taski/execution/task_output_pipe.rb', line 16 def close_write @write_io.close unless @write_io.closed? end |
#closed? ⇒ Boolean
37 38 39 |
# File 'lib/taski/execution/task_output_pipe.rb', line 37 def closed? write_closed? && read_closed? end |
#read_closed? ⇒ Boolean
33 34 35 |
# File 'lib/taski/execution/task_output_pipe.rb', line 33 def read_closed? @read_io.closed? end |
#write_closed? ⇒ Boolean
29 30 31 |
# File 'lib/taski/execution/task_output_pipe.rb', line 29 def write_closed? @write_io.closed? end |