Sha256: d365fdc2d9fc8b895e27a860d22647749880b423d3e66b0aa2848f827913890a

Contents?: true

Size: 460 Bytes

Versions: 2

Compression:

Stored size: 460 Bytes

Contents

module Kernel

  # Sets $VERBOSE to nil for the duration of the block and back to its original value afterwards.
  #
  #   silence_warnings do
  #     value = noisy_call # no warning voiced
  #   end
  #
  #   noisy_call # warning voiced
  def silence_warnings
    old_verbose, $VERBOSE = $VERBOSE, nil
    yield
  ensure
    $VERBOSE = old_verbose
  end

  def using(o=nil)
    begin
      yield if block_given?
    ensure
      o.dispose 
    end
  end


end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ironnails-0.0.3 lib/ironnails/core_ext/kernel.rb
ironnails-0.0.1 lib/ironnails/core_ext/kernel.rb