Class: WarningsLogger::Spy
- Inherits:
-
Object
- Object
- WarningsLogger::Spy
- Extended by:
- Forwardable
- Defined in:
- lib/warnings_logger/spy.rb
Overview
Adapted from <myronmars.to/n/dev-blog/2011/08/making-your-gem-warning-free>
Class Method Summary collapse
Instance Method Summary collapse
- #enable ⇒ Object
-
#initialize(configuration) ⇒ Spy
constructor
A new instance of Spy.
Constructor Details
#initialize(configuration) ⇒ Spy
Returns a new instance of Spy.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/warnings_logger/spy.rb', line 23 def initialize(configuration) @filesystem = Filesystem.new(configuration) @reader = Reader.new(filesystem) @partitioner = Partitioner.new( configuration: configuration, reader: reader ) @reporter = Reporter.new( configuration: configuration, filesystem: filesystem, partitioner: partitioner ) @original_stderr = nil end |
Class Method Details
.call(**options) ⇒ Object
DEPRECATED
7 8 9 10 11 12 13 14 15 |
# File 'lib/warnings_logger/spy.rb', line 7 def self.call(**) WarningsLogger.configure do |config| .each do |key, value| config.public_send("#{key}=", value) end end WarningsLogger.enable end |
.enable(configuration) ⇒ Object
17 18 19 |
# File 'lib/warnings_logger/spy.rb', line 17 def self.enable(configuration) new(configuration).enable end |
Instance Method Details
#enable ⇒ Object
39 40 41 42 43 |
# File 'lib/warnings_logger/spy.rb', line 39 def enable filesystem.prepare capture_warnings report_warnings_after_tests_run end |