module StructuredWarnings::ClassMethods
If you require "test/unit"
after
structured_warnings
you have to require
"structured_warnings/test"
manually, otherwise the test
extensions will be added automatically.
Public Instance Methods
warner()
click to toggle source
Gives access to the currently used warner. Default is an instance of StructuredWarnings::Warner
# File lib/structured_warnings.rb, line 23 def warner Dynamic[:warner] end
with_warner(warner) { || ... }
click to toggle source
Executes a block using the given warner. This may be used to suppress warnings to stdout, but fetch them and redirect them to somewhere else.
This behaviour is used in the StructuredWarnings::Assertions
# File lib/structured_warnings.rb, line 15 def with_warner(warner) Dynamic.let(:warner => warner) do yield end end