Module: Kernel

Defined in:
lib/capture_stdout.rb

Instance Method Summary collapse

Instance Method Details

#capture_stdoutObject



4
5
6
7
8
9
10
11
# File 'lib/capture_stdout.rb', line 4

def capture_stdout
  out = StringIO.new
  $stdout = out
  yield
  return out.string
ensure
  $stdout = STDOUT
end