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 deprecated objects
Instance Attribute Summary collapse
-
#class_constant ⇒ Object
readonly
Returns the value of attribute class_constant.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
Instance Method Summary collapse
- #class_nodes ⇒ Object
- #correctable? ⇒ Boolean
-
#initialize(method, class_constant: nil, correctable: true) ⇒ DeprecatedClassMethod
constructor
A new instance of DeprecatedClassMethod.
- #to_s ⇒ Object
Constructor Details
#initialize(method, class_constant: nil, correctable: true) ⇒ DeprecatedClassMethod
Returns a new instance of DeprecatedClassMethod.
40 41 42 43 44 |
# File 'lib/rubocop/cop/lint/deprecated_class_methods.rb', line 40 def initialize(method, class_constant: nil, correctable: true) @method = method @class_constant = class_constant @correctable = correctable end |
Instance Attribute Details
#class_constant ⇒ Object (readonly)
Returns the value of attribute class_constant.
38 39 40 |
# File 'lib/rubocop/cop/lint/deprecated_class_methods.rb', line 38 def class_constant @class_constant end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
38 39 40 |
# File 'lib/rubocop/cop/lint/deprecated_class_methods.rb', line 38 def method @method end |
Instance Method Details
#class_nodes ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/rubocop/cop/lint/deprecated_class_methods.rb', line 46 def class_nodes @class_nodes ||= if class_constant [ s(:const, nil, class_constant), s(:const, s(:cbase), class_constant) ] else [nil] end end |
#correctable? ⇒ Boolean
58 59 60 |
# File 'lib/rubocop/cop/lint/deprecated_class_methods.rb', line 58 def correctable? @correctable end |
#to_s ⇒ Object
62 63 64 |
# File 'lib/rubocop/cop/lint/deprecated_class_methods.rb', line 62 def to_s [class_constant, method].compact.join(delimiter) end |