module Docspec::OutputCapturer

Public Instance Methods

capture_output() { || ... } click to toggle source
# File lib/docspec/output_capturer.rb, line 5
def capture_output
  original_stdout = $stdout
  $stdout = StringIO.new
  begin
    yield
    $stdout.string
  rescue => e
    "#{$stdout.string}#{e.inspect}"
  ensure
    $stdout = original_stdout
  end
end