class CI::Reporter::OutputCapture
Captures $stdout or $stderr in order report it in the XML file.
Public Class Methods
new(io, &assign)
click to toggle source
# File lib/ci/reporter/output_capture.rb, line 13 def initialize(io, &assign) @original_io = io @captured_io = StringIO.new @assign_block = assign end
wrap(io, &assign)
click to toggle source
Creates an OutputCapture
and immediately starts capturing.
# File lib/ci/reporter/output_capture.rb, line 9 def self.wrap(io, &assign) new(io, &assign).tap {|oc| oc.start} end
Public Instance Methods
finish()
click to toggle source
Finalize the capture and reset to the original IO object.
# File lib/ci/reporter/output_capture.rb, line 25 def finish @assign_block.call(@original_io) @captured_io.string end
start()
click to toggle source
Start capturing IO.
# File lib/ci/reporter/output_capture.rb, line 20 def start @assign_block.call(@captured_io) end