Class: RSpec::Core::Formatters::DeprecationFormatter
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/deprecation_formatter.rb
Defined Under Namespace
Classes: DelayedPrinter, FileStream, GeneratedDeprecationMessage, ImmediatePrinter, RaiseErrorStream, SpecifiedDeprecationMessage
Constant Summary collapse
- RAISE_ERROR_CONFIG_NOTICE =
<<-EOS.gsub(/^\s+\|/, '') | |If you need more of the backtrace for any of these deprecations to |identify where to make the necessary changes, you can configure |`config.raise_errors_for_deprecations!`, and it will turn the |deprecation warnings into errors, giving you the full backtrace. EOS
- DEPRECATION_STREAM_NOTICE =
"Pass `--deprecation-out` or set " \ "`config.deprecation_stream` to a file for full output."
- TOO_MANY_WARNINGS_NOTICE =
"Too many similar deprecation messages " \ "reported, disregarding further reports. #{DEPRECATION_STREAM_NOTICE}"
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#deprecation_stream ⇒ Object
(also: #output)
readonly
Returns the value of attribute deprecation_stream.
-
#summary_stream ⇒ Object
readonly
Returns the value of attribute summary_stream.
Instance Method Summary collapse
- #deprecation(notification) ⇒ Object
- #deprecation_message_for(data) ⇒ Object
- #deprecation_summary(_notification) ⇒ Object
-
#initialize(deprecation_stream, summary_stream) ⇒ DeprecationFormatter
constructor
A new instance of DeprecationFormatter.
- #printer ⇒ Object
Constructor Details
#initialize(deprecation_stream, summary_stream) ⇒ DeprecationFormatter
Returns a new instance of DeprecationFormatter.
12 13 14 15 16 17 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/deprecation_formatter.rb', line 12 def initialize(deprecation_stream, summary_stream) @deprecation_stream = deprecation_stream @summary_stream = summary_stream @seen_deprecations = Set.new @count = 0 end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
10 11 12 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/deprecation_formatter.rb', line 10 def count @count end |
#deprecation_stream ⇒ Object (readonly) Also known as: output
Returns the value of attribute deprecation_stream.
10 11 12 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/deprecation_formatter.rb', line 10 def deprecation_stream @deprecation_stream end |
#summary_stream ⇒ Object (readonly)
Returns the value of attribute summary_stream.
10 11 12 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/deprecation_formatter.rb', line 10 def summary_stream @summary_stream end |
Instance Method Details
#deprecation(notification) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/deprecation_formatter.rb', line 32 def deprecation(notification) return if @seen_deprecations.include? notification @count += 1 printer. notification @seen_deprecations << notification end |
#deprecation_message_for(data) ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/deprecation_formatter.rb', line 44 def (data) if data. SpecifiedDeprecationMessage.new(data) else GeneratedDeprecationMessage.new(data) end end |
#deprecation_summary(_notification) ⇒ Object
40 41 42 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/deprecation_formatter.rb', line 40 def deprecation_summary(_notification) printer.deprecation_summary end |
#printer ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/deprecation_formatter.rb', line 20 def printer @printer ||= case deprecation_stream when File ImmediatePrinter.new(FileStream.new(deprecation_stream), summary_stream, self) when RaiseErrorStream ImmediatePrinter.new(deprecation_stream, summary_stream, self) else DelayedPrinter.new(deprecation_stream, summary_stream, self) end end |