Class: Test::Unit::TestSuiteProcessRunner::Worker
- Inherits:
-
Object
- Object
- Test::Unit::TestSuiteProcessRunner::Worker
- Defined in:
- lib/test/unit/test-suite-process-runner.rb
Instance Attribute Summary collapse
-
#main_to_worker_output ⇒ Object
readonly
Returns the value of attribute main_to_worker_output.
-
#worker_to_main_input ⇒ Object
readonly
Returns the value of attribute worker_to_main_input.
Instance Method Summary collapse
-
#initialize(pid, main_to_worker_output, worker_to_main_input) ⇒ Worker
constructor
A new instance of Worker.
-
#receive ⇒ Object
-
#send(data) ⇒ Object
-
#wait ⇒ Object
Constructor Details
#initialize(pid, main_to_worker_output, worker_to_main_input) ⇒ Worker
Returns a new instance of Worker.
23 24 25 26 27 |
# File 'lib/test/unit/test-suite-process-runner.rb', line 23 def initialize(pid, main_to_worker_output, worker_to_main_input) @pid = pid @main_to_worker_output = main_to_worker_output @worker_to_main_input = worker_to_main_input end |
Instance Attribute Details
#main_to_worker_output ⇒ Object (readonly)
Returns the value of attribute main_to_worker_output.
22 23 24 |
# File 'lib/test/unit/test-suite-process-runner.rb', line 22 def main_to_worker_output @main_to_worker_output end |
#worker_to_main_input ⇒ Object (readonly)
Returns the value of attribute worker_to_main_input.
22 23 24 |
# File 'lib/test/unit/test-suite-process-runner.rb', line 22 def worker_to_main_input @worker_to_main_input end |
Instance Method Details
#receive ⇒ Object
29 30 31 |
# File 'lib/test/unit/test-suite-process-runner.rb', line 29 def receive Marshal.load(@worker_to_main_input) end |
#send(data) ⇒ Object
33 34 35 36 |
# File 'lib/test/unit/test-suite-process-runner.rb', line 33 def send(data) Marshal.dump(data, @main_to_worker_output) @main_to_worker_output.flush end |
#wait ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/test/unit/test-suite-process-runner.rb', line 38 def wait begin Process.waitpid(@pid) ensure begin @main_to_worker_output.close ensure @worker_to_main_input.close end end end |