Module: Kernel

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

Instance Method Summary collapse

Instance Method Details

#yield_and_collect_stderrObject



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

def yield_and_collect_stderr
  # so many lol effects
  old_err = $stderr
  $stderr = StringIO.new
  r = yield
  warns = $stderr.string
  [r, warns]
ensure
  $stderr = old_err
end