Class: RuboCop::Cop::Lint::DeprecatedClassMethods::DeprecatedClassMethod
- Inherits:
-
Object
- Object
- RuboCop::Cop::Lint::DeprecatedClassMethods::DeprecatedClassMethod
- Includes:
- AST::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
-
#class_constant ⇒ Object
readonly
Returns the value of attribute class_constant.
-
#deprecated_method ⇒ Object
readonly
Returns the value of attribute deprecated_method.
-
#replacement_method ⇒ Object
readonly
Returns the value of attribute replacement_method.
Instance Method Summary collapse
- #class_nodes ⇒ Object
-
#initialize(deprecated:, replacement:, class_constant: nil) ⇒ DeprecatedClassMethod
constructor
A new instance of DeprecatedClassMethod.
Methods included from AST::Sexp
Constructor Details
#initialize(deprecated:, replacement:, class_constant: nil) ⇒ DeprecatedClassMethod
Returns a new instance of DeprecatedClassMethod.
32 33 34 35 36 |
# File 'lib/rubocop/cop/lint/deprecated_class_methods.rb', line 32 def initialize(deprecated:, replacement:, class_constant: nil) @deprecated_method = deprecated @replacement_method = replacement @class_constant = class_constant end |
Instance Attribute Details
#class_constant ⇒ Object (readonly)
Returns the value of attribute class_constant.
30 31 32 |
# File 'lib/rubocop/cop/lint/deprecated_class_methods.rb', line 30 def class_constant @class_constant end |
#deprecated_method ⇒ Object (readonly)
Returns the value of attribute deprecated_method.
30 31 32 |
# File 'lib/rubocop/cop/lint/deprecated_class_methods.rb', line 30 def deprecated_method @deprecated_method end |
#replacement_method ⇒ Object (readonly)
Returns the value of attribute replacement_method.
30 31 32 |
# File 'lib/rubocop/cop/lint/deprecated_class_methods.rb', line 30 def replacement_method @replacement_method end |
Instance Method Details
#class_nodes ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/rubocop/cop/lint/deprecated_class_methods.rb', line 38 def class_nodes @class_nodes ||= if class_constant [ s(:const, nil, class_constant), s(:const, s(:cbase), class_constant) ] else [nil] end end |