Class: RSpec::Core::Formatters::DeprecationFormatter::GeneratedDeprecationMessage

Inherits:
Struct
  • Object
show all
Defined in:
lib/rspec/core/formatters/deprecation_formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ GeneratedDeprecationMessage

Returns a new instance of GeneratedDeprecationMessage.



93
94
95
96
# File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 93

def initialize(data)
  @data = data
  super data.fetch(:type, data[:deprecated])
end

Instance Attribute Details

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



92
93
94
# File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 92

def type
  @type
end

Instance Method Details

#to_sObject



98
99
100
101
102
103
# File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 98

def to_s
  msg =  "#{@data[:deprecated]} is deprecated."
  msg << " Use #{@data[:replacement]} instead." if @data[:replacement]
  msg << " Called from #{@data[:call_site]}." if @data[:call_site]
  msg
end

#too_many_warnings_messageObject



105
106
107
108
109
# File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 105

def too_many_warnings_message
  msg = "Too many uses of deprecated '#{type}'. "
  msg << DEPRECATION_STREAM_NOTICE
  msg
end