Sha256: a9cb8894257deac9f1bdcb9630735e239d063a7f1b245f69b76f97c2a5d5e8ec

Contents?: true

Size: 469 Bytes

Versions: 50

Compression:

Stored size: 469 Bytes

Contents

module Kernel
  def silence_warnings
    with_warnings(nil) { yield }
  end

  def silence_stream(stream)
    old_stream = stream.dup
    stream.reopen(RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? 'NUL:' : '/dev/null')
    stream.sync = true
    yield
  ensure
    stream.reopen(old_stream)
  end

  def with_warnings(flag)
    old_verbose, $VERBOSE = $VERBOSE, flag
    yield
  ensure
    $VERBOSE = old_verbose
  end
end unless Kernel.respond_to? :silence_warnings

Version data entries

50 entries across 50 versions & 2 rubygems

Version Path
rabl-0.14.0 test/silence.rb
rabl-0.13.1 test/silence.rb
rabl-0.13.0 test/silence.rb
rabl-0.12.0 test/silence.rb
rabl-0.11.8 test/silence.rb
rabl-0.11.7 test/silence.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/rabl-0.11.6/test/silence.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/rabl-0.11.6/test/silence.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/rabl-0.11.6/test/silence.rb
rabl-0.11.6 test/silence.rb
rabl-0.11.5 test/silence.rb
rabl-0.11.4 test/silence.rb
rabl-0.11.3 test/silence.rb
rabl-0.11.2 test/silence.rb
rabl-0.11.1 test/silence.rb
rabl-0.11.0 test/silence.rb
rabl-0.10.1 test/silence.rb
rabl-0.10.0 test/silence.rb
rabl-0.9.4.pre1 test/silence.rb
rabl-0.9.3 test/silence.rb