File: capture_warning.rb

package info (click to toggle)
ruby-http 4.4.1-6
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 704 kB
  • sloc: ruby: 5,388; makefile: 9
file content (10 lines) | stat: -rw-r--r-- 158 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
# frozen_string_literal: true

def capture_warning
  old_stderr = $stderr
  $stderr = StringIO.new
  yield
  $stderr.string
ensure
  $stderr = old_stderr
end