Module: Kernel

Defined in:
lib/luffa/patches/kernel.rb

Instance Method Summary collapse

Instance Method Details

#capture_stderrObject



11
12
13
14
15
16
17
18
# File 'lib/luffa/patches/kernel.rb', line 11

def capture_stderr
  out = StringIO.new
  $stderr = out
  yield
  return out
ensure
  $stderr = STDERR
end

#capture_stdoutObject



2
3
4
5
6
7
8
9
# File 'lib/luffa/patches/kernel.rb', line 2

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