Sha256: 0b7eb954ab3974bf5a8fd7fd95dcccc41892bc5003830159c48137f9306099db

Contents?: true

Size: 577 Bytes

Versions: 6

Compression:

Stored size: 577 Bytes

Contents

# -*- coding: utf-8 -*-
# From [Ruby verbose mode and how it's broken][1] by Mislav Marohnić
# [1]: http://mislav.uniqpath.com/2011/06/ruby-verbose-mode/
#
# Silence Ruby verbose output.  Use this to quiet warnings from
# a third-party library:
#
#     silence_warnings do
#       require "library_with_many_warnings"
#     end
module Kernel

  def silence_warnings
    with_warnings(nil) { yield }
  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

6 entries across 6 versions & 1 rubygems

Version Path
cute_print-1.1.4 spec/silence_warnings.rb
cute_print-1.1.3 spec/silence_warnings.rb
cute_print-1.1.2 spec/silence_warnings.rb
cute_print-1.1.1 spec/silence_warnings.rb
cute_print-1.1.0 spec/silence_warnings.rb
cute_print-1.0.1 spec/silence_warnings.rb