class RSpec::Core::Formatters::DeprecationFormatter

@private

Constants

DEPRECATION_STREAM_NOTICE
GeneratedDeprecationMessage

@private

RAISE_ERROR_CONFIG_NOTICE
SpecifiedDeprecationMessage

@private

TOO_MANY_WARNINGS_NOTICE

Attributes

Public Class Methods

# File rspec-core/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

Public Instance Methods

# File rspec-core/lib/rspec/core/formatters/deprecation_formatter.rb, line 32
def deprecation(notification)
  return if @seen_deprecations.include? notification

  @count += 1
  printer.print_deprecation_message notification
  @seen_deprecations << notification
end
# File rspec-core/lib/rspec/core/formatters/deprecation_formatter.rb, line 44
def deprecation_message_for(data)
  if data.message
    SpecifiedDeprecationMessage.new(data)
  else
    GeneratedDeprecationMessage.new(data)
  end
end
# File rspec-core/lib/rspec/core/formatters/deprecation_formatter.rb, line 40
def deprecation_summary(_notification)
  printer.deprecation_summary
end
# File rspec-core/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