Class: RuboCop::ConfigObsoletion::ParameterRule Private

Inherits:
Rule
  • Object
show all
Defined in:
lib/rubocop/config_obsoletion/parameter_rule.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.

Base class for ConfigObsoletion rules relating to parameters

Direct Known Subclasses

ChangedEnforcedStyles, ChangedParameter

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Rule

#cop_rule?

Constructor Details

#initialize(config, cop, parameter, metadata) ⇒ ParameterRule

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 ParameterRule.


10
11
12
13
14
15
# File 'lib/rubocop/config_obsoletion/parameter_rule.rb', line 10

def initialize(config, cop, parameter, )
  super(config)
  @cop = cop
  @parameter = parameter
  @metadata = 
end

Instance Attribute Details

#copObject (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.


8
9
10
# File 'lib/rubocop/config_obsoletion/parameter_rule.rb', line 8

def cop
  @cop
end

#metadataObject (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.


8
9
10
# File 'lib/rubocop/config_obsoletion/parameter_rule.rb', line 8

def 
  @metadata
end

#parameterObject (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.


8
9
10
# File 'lib/rubocop/config_obsoletion/parameter_rule.rb', line 8

def parameter
  @parameter
end

Instance Method Details

#parameter_rule?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.

Returns:

  • (Boolean)

17
18
19
# File 'lib/rubocop/config_obsoletion/parameter_rule.rb', line 17

def parameter_rule?
  true
end

#violated?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.

Returns:

  • (Boolean)

21
22
23
# File 'lib/rubocop/config_obsoletion/parameter_rule.rb', line 21

def violated?
  config[cop]&.key?(parameter)
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.

Returns:

  • (Boolean)

25
26
27
# File 'lib/rubocop/config_obsoletion/parameter_rule.rb', line 25

def warning?
  severity == 'warning'
end