aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support.rb1
-rw-r--r--activesupport/lib/active_support/core_ext/kernel.rb14
-rw-r--r--activesupport/lib/active_support/misc.rb8
3 files changed, 14 insertions, 9 deletions
diff --git a/activesupport/lib/active_support.rb b/activesupport/lib/active_support.rb
index ba6945f3e5..7c7ae56e61 100644
--- a/activesupport/lib/active_support.rb
+++ b/activesupport/lib/active_support.rb
@@ -29,7 +29,6 @@ require 'active_support/inflector'
require 'active_support/core_ext'
require 'active_support/clean_logger'
-require 'active_support/misc'
require 'active_support/dependencies'
require 'active_support/values/time_zone' \ No newline at end of file
diff --git a/activesupport/lib/active_support/core_ext/kernel.rb b/activesupport/lib/active_support/core_ext/kernel.rb
index a2cb827d77..d4c3114488 100644
--- a/activesupport/lib/active_support/core_ext/kernel.rb
+++ b/activesupport/lib/active_support/core_ext/kernel.rb
@@ -14,4 +14,18 @@ module Kernel
yield
value
end
+
+ # Sets $VERBOSE to nil for the duration of the block and back to its original value afterwards.
+ #
+ # silence_warnings do
+ # noisy_call # no warning voiced
+ # end
+ #
+ # noisy_call # warning voiced
+ def silence_warnings
+ old_verbose, $VERBOSE = $VERBOSE, nil
+ yield
+ ensure
+ $VERBOSE = old_verbose
+ end
end
diff --git a/activesupport/lib/active_support/misc.rb b/activesupport/lib/active_support/misc.rb
deleted file mode 100644
index 1ca00db1e7..0000000000
--- a/activesupport/lib/active_support/misc.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-def silence_warnings
- old_verbose, $VERBOSE = $VERBOSE, nil
- begin
- yield
- ensure
- $VERBOSE = old_verbose
- end
-end