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.



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

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.



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

def class_constant
  @class_constant
end

#methodObject (readonly)

Returns the value of attribute method.



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

def method
  @method
end

Instance Method Details

#to_sObject



85
86
87
# File 'lib/rubocop/cop/lint/deprecated_class_methods.rb', line 85

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