deliveroo/routemaster

View on GitHub
core_ext/silence_stream.rb

Summary

Maintainability
A
0 mins
Test Coverage
# Adapted from
# activesupport/lib/active_support/core_ext/kernel/reporting.rb, line 44
class IO
  def silence_stream
    old_stream = dup
    self.reopen('/dev/null')
    self.sync = true
    yield
  ensure
    reopen(old_stream)
    old_stream.close
  end
end