Class: CI::Reporter::OutputCapture
- Inherits:
-
IO
- Object
- IO
- CI::Reporter::OutputCapture
- Defined in:
- lib/ci/reporter/test_suite.rb
Overview
Emulates/delegates IO to $stdout or $stderr in order to capture output to report in the XML file.
Instance Method Summary collapse
-
#finish ⇒ Object
Finalize the capture and reset to the original IO object.
-
#initialize(io, &assign) ⇒ OutputCapture
constructor
Start capturing IO, using the given block to assign self to the proper IO global.
Constructor Details
#initialize(io, &assign) ⇒ OutputCapture
Start capturing IO, using the given block to assign self to the proper IO global.
13 14 15 16 17 18 19 |
# File 'lib/ci/reporter/test_suite.rb', line 13 def initialize(io, &assign) super @delegate_io = io @captured_io = StringIO.new @assign_block = assign @assign_block.call self end |
Instance Method Details
#finish ⇒ Object
Finalize the capture and reset to the original IO object.
22 23 24 25 |
# File 'lib/ci/reporter/test_suite.rb', line 22 def finish @assign_block.call @delegate_io @captured_io.string end |