lib/lotus/utils/io.rb in lotus-utils-0.2.0 vs lib/lotus/utils/io.rb in lotus-utils-0.3.0
- old
+ new
@@ -5,13 +5,13 @@
# @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
+ # @see https://github.com/rails/rails/blob/v4.1.2/activesupport/lib/active_support/core_ext/kernel/reporting.rb#L25
#
- # @param blk [Proc] the block of code that generates warnings.
+ # @yield the block of code that generates warnings.
#
# @return [void]
#
# @since 0.1.0
#
@@ -23,12 +23,12 @@
# end
#
# Lotus::Utils::IO.silence_warnings do
# Test::TEST_VALUE = 'redefined'
# end
- def self.silence_warnings(&blk)
+ def self.silence_warnings
old_verbose, $VERBOSE = $VERBOSE, nil
- blk.call
+ yield
ensure
$VERBOSE = old_verbose
end
end
end