Sha256: 1767acbbabd2cb5d7abcc750b7aaed605a4ec8bb7cc7d7b70a81fdbd4486ad38

Contents?: true

Size: 559 Bytes

Versions: 26

Compression:

Stored size: 559 Bytes

Contents

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

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
facets-1.0.3 packages/core/lib/facet/kernel/silently.rb
facets-1.0.0 lib/facet/kernel/silently.rb
facets-0.9.0 lib/nano/kernel/silently.rb
facets-1.2.1 lib/facets/core/kernel/silently.rb
facets-1.1.0 lib/facet/kernel/silently.rb
facets-1.2.0 lib/facets/core/kernel/silently.rb
facets-1.3.0 lib/facets/core/kernel/silently.rb
facets-1.3.1 lib/facets/core/kernel/silently.rb
facets-1.3.2 lib/facets/core/kernel/silently.rb
facets-1.3.3 lib/facets/core/kernel/silently.rb
facets-1.4.1 lib/facets/core/kernel/silently.rb
facets-1.4.0 lib/facets/core/kernel/silently.rb
facets-1.4.2 lib/facets/core/kernel/silently.rb
facets-1.4.3 lib/facets/core/kernel/silently.rb
facets-1.4.4 lib/facets/core/kernel/silently.rb
facets-1.4.5 lib/facets/core/kernel/silently.rb
facets-1.7.0 lib/facets/core/kernel/silently.rb
facets-1.7.30 lib/facets/core/kernel/silently.rb
facets-1.7.38 lib/facets/core/kernel/silently.rb
facets-1.7.46 lib/facets/core/kernel/silently.rb