Class: RuboCop::Cop::Lint::DeprecatedClassMethods::Replacement

Inherits:
Object
  • Object
show all
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 replacements for deprecated objects

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method, class_constant: nil, instance_method: false) ⇒ Replacement

Returns a new instance of Replacement.


77
78
79
80
81
# File 'lib/rubocop/cop/lint/deprecated_class_methods.rb', line 77

def initialize(method, class_constant: nil, instance_method: false)
  @method = method
  @class_constant = class_constant
  @instance_method = instance_method
end

Instance Attribute Details

#class_constantObject (readonly)

Returns the value of attribute class_constant.


75
76
77
# File 'lib/rubocop/cop/lint/deprecated_class_methods.rb', line 75

def class_constant
  @class_constant
end

#methodObject (readonly)

Returns the value of attribute method.


75
76
77
# File 'lib/rubocop/cop/lint/deprecated_class_methods.rb', line 75

def method
  @method
end

Instance Method Details

#to_sObject


83
84
85
# File 'lib/rubocop/cop/lint/deprecated_class_methods.rb', line 83

def to_s
  [class_constant, method].compact.join(delimiter)
end