Class: RuboCop::Cop::Lint::DeprecatedClassMethods::DeprecatedClassMethod

Inherits:
Object
  • Object
show all
Includes:
Sexp
Defined in:
lib/rubocop/cop/lint/deprecated_class_methods.rb

Overview

Inner class to DeprecatedClassMethods. This class exists to add abstraction and clean naming to the objects that are going to be operated on.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Sexp

#s

Constructor Details

#initialize(class_constant, deprecated_method, replacement_method) ⇒ DeprecatedClassMethod

Returns a new instance of DeprecatedClassMethod.


17
18
19
20
21
# File 'lib/rubocop/cop/lint/deprecated_class_methods.rb', line 17

def initialize(class_constant, deprecated_method, replacement_method)
  @class_constant = class_constant
  @deprecated_method = deprecated_method
  @replacement_method = replacement_method
end

Instance Attribute Details

#class_constantObject (readonly)

Returns the value of attribute class_constant


15
16
17
# File 'lib/rubocop/cop/lint/deprecated_class_methods.rb', line 15

def class_constant
  @class_constant
end

#deprecated_methodObject (readonly)

Returns the value of attribute deprecated_method


15
16
17
# File 'lib/rubocop/cop/lint/deprecated_class_methods.rb', line 15

def deprecated_method
  @deprecated_method
end

#replacement_methodObject (readonly)

Returns the value of attribute replacement_method


15
16
17
# File 'lib/rubocop/cop/lint/deprecated_class_methods.rb', line 15

def replacement_method
  @replacement_method
end

Instance Method Details

#class_nodesObject


23
24
25
26
27
28
# File 'lib/rubocop/cop/lint/deprecated_class_methods.rb', line 23

def class_nodes
  @class_nodes ||= [
    s(:const, nil, class_constant),
    s(:const, s(:cbase), class_constant)
  ]
end