start 2
[sinatra.git] / lib / sinatra / core_ext / kernel.rb
blobe8b7a43e03c8ec4bd0b421ebe32a4a3cafb17733
1 module Kernel
2   # (Taken from ActiveSupport)
3   # Sets $VERBOSE to nil for the duration of the block and back to its original value afterwards.
4   #
5   #   silence_warnings do
6   #     value = noisy_call # no warning voiced
7   #   end
8   #
9   #   noisy_call # warning voiced
10   def silence_warnings
11     old_verbose, $VERBOSE = $VERBOSE, nil
12     yield
13   ensure
14     $VERBOSE = old_verbose
15   end
16 end