Class: RuboCop::ConfigObsoletion::RenamedCop Private
- 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
- #metadata ⇒ Object readonly private
- #new_name ⇒ Object readonly private
Attributes inherited from CopRule
Instance Method Summary collapse
-
#initialize(config, old_name, name_or_hash) ⇒ RenamedCop
constructor
private
A new instance of RenamedCop.
- #rule_message ⇒ Object private
- #warning? ⇒ Boolean private
Methods inherited from CopRule
#cop_rule?, #message, #violated?
Methods inherited from Rule
#cop_rule?, #parameter_rule?, #violated?
Constructor Details
#initialize(config, old_name, name_or_hash) ⇒ 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 15 16 17 18 19 20 21 |
# File 'lib/rubocop/config_obsoletion/renamed_cop.rb', line 11 def initialize(config, old_name, name_or_hash) super(config, old_name) if name_or_hash.is_a?(Hash) @metadata = name_or_hash @new_name = name_or_hash['new_name'] else @metadata = {} @new_name = name_or_hash end end |
Instance Attribute Details
#metadata ⇒ Object (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 @metadata end |
#new_name ⇒ Object (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_message ⇒ Object
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.
23 24 25 |
# File 'lib/rubocop/config_obsoletion/renamed_cop.rb', line 23 def "The `#{old_name}` cop has been #{verb} to `#{new_name}`." end |
#warning? ⇒ Boolean
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.
27 28 29 |
# File 'lib/rubocop/config_obsoletion/renamed_cop.rb', line 27 def warning? severity == 'warning' end |