
module Kernel

  # Temporarily turn-off verbose mode while yielding block.
  #
  def silently #:yield:
    old_verbose, $VERBOSE = $VERBOSE, nil
    begin
      yield
    ensure
      $VERBOSE = old_verbose
    end
  end

  alias_method :silence_warnings, :silently

end



#  _____         _
# |_   _|__  ___| |_
#   | |/ _ \/ __| __|
#   | |  __/\__ \ |_
#   |_|\___||___/\__|
#
=begin test

  require 'test/unit'

  class TCKernel < Test::Unit::TestCase

    def test_silently
      silently do
        assert( ! $VERBOSE )
      end
    end

  end

=end
