Sha256: d7ae8173a822f0a1ebf3e187291b6e75f0d0d88774cefe9b814264a163e6d5da
Contents?: true
Size: 929 Bytes
Versions: 33
Compression:
Stored size: 929 Bytes
Contents
module Hanami module Utils # IO utils # # @since 0.1.0 class IO # Decreases the level of verbosity, during the execution of the given block. # # Revised version of ActiveSupport's `Kernel.with_warnings` implementation # @see https://github.com/rails/rails/blob/v4.1.2/activesupport/lib/active_support/core_ext/kernel/reporting.rb#L25 # # @yield the block of code that generates warnings. # # @return [void] # # @since 0.1.0 # # @example # require 'hanami/utils/io' # # class Test # TEST_VALUE = 'initial' # end # # Hanami::Utils::IO.silence_warnings do # Test::TEST_VALUE = 'redefined' # end def self.silence_warnings old_verbose = $VERBOSE $VERBOSE = nil yield ensure $VERBOSE = old_verbose end end end end
Version data entries
33 entries across 33 versions & 1 rubygems