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



95
96
97
98
# File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 95

def initialize(data)
  @data = data
  super data.deprecated
end

Instance Attribute Details

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



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

def type
  @type
end

Instance Method Details

#to_sObject



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

def to_s
  msg = String.new("#{@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



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

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