Sha256: 6dc618f705256650a65ed8c9ce736a1cb27789fb7c18c0400dd7a2856964de07
Contents?: true
Size: 936 Bytes
Versions: 3
Compression:
Stored size: 936 Bytes
Contents
module Lotus 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/master/activesupport/lib/active_support/core_ext/kernel/reporting.rb#L25 # # @param blk [Proc] the block of code that generates warnings. # # @return [void] # # @since 0.1.0 # # @example # require 'lotus/utils/io' # # class Test # TEST_VALUE = 'initial' # end # # Lotus::Utils::IO.silence_warnings do # Test::TEST_VALUE = 'redefined' # end def self.silence_warnings(&blk) old_verbose, $VERBOSE = $VERBOSE, nil blk.call ensure $VERBOSE = old_verbose end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lotus-utils-0.2.0 | lib/lotus/utils/io.rb |
lotus-utils-0.1.1 | lib/lotus/utils/io.rb |
lotus-utils-0.1.0 | lib/lotus/utils/io.rb |