Class: RuboCop::ConfigObsoletion::RenamedCop Private

Inherits:
CopRule
  • Object
show all
Defined in:
lib/rubocop/config_obsoletion/renamed_cop.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Encapsulation of a ConfigObsoletion rule for renaming a cop or moving it to a new department.

Instance Attribute Summary collapse

Attributes inherited from CopRule

#old_name

Instance Method Summary collapse

Methods inherited from CopRule

#cop_rule?, #message, #violated?, #warning?

Methods inherited from Rule

#cop_rule?, #parameter_rule?, #violated?

Constructor Details

#initialize(config, old_name, new_name) ⇒ RenamedCop

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of RenamedCop.



11
12
13
14
# File 'lib/rubocop/config_obsoletion/renamed_cop.rb', line 11

def initialize(config, old_name, new_name)
  super(config, old_name)
  @new_name = new_name
end

Instance Attribute Details

#new_nameObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



9
10
11
# File 'lib/rubocop/config_obsoletion/renamed_cop.rb', line 9

def new_name
  @new_name
end

Instance Method Details

#rule_messageObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16
17
18
# File 'lib/rubocop/config_obsoletion/renamed_cop.rb', line 16

def rule_message
  "The `#{old_name}` cop has been #{verb} to `#{new_name}`."
end