diff --git a/lib/haml/util.rb b/lib/haml/util.rb index 48555b02..040b646d 100755 --- a/lib/haml/util.rb +++ b/lib/haml/util.rb @@ -153,25 +153,6 @@ module Haml $stderr = the_real_stderr end - # Silences all Haml warnings within a block. - # - # @yield A block in which no Haml warnings will be printed - def silence_haml_warnings - old_silence_warnings = Thread.current[:silence_haml_warnings] - Thread.current[:silence_haml_warnings] = true - yield - ensure - Thread.current[:silence_haml_warnings] = old_silence_warnings - end - - # The same as `Kernel#warn`, but is silenced by \{#silence\_haml\_warnings}. - # - # @param msg [String] - def haml_warn(msg) - return if Thread.current[:silence_haml_warnings] - warn(msg) - end - ## Cross Rails Version Compatibility # Returns the root of the Rails application, diff --git a/test/util_test.rb b/test/util_test.rb index c229b271..beb1b296 100644 --- a/test/util_test.rb +++ b/test/util_test.rb @@ -67,20 +67,6 @@ class UtilTest < MiniTest::Unit::TestCase $stderr = old_stderr end - def test_haml_warn - assert_warning("Foo!") {haml_warn "Foo!"} - end - - def test_silence_haml_warnings - old_stderr, $stderr = $stderr, StringIO.new - silence_haml_warnings {warn "Out"} - assert_equal("Out\n", $stderr.string) - silence_haml_warnings {haml_warn "In"} - assert_equal("Out\n", $stderr.string) - ensure - $stderr = old_stderr - end - def test_has assert(has?(:instance_method, String, :chomp!)) assert(has?(:private_instance_method, Haml::Engine, :set_locals))