Class: Steep::Diagnostic::Ruby::UnknownConstantAssigned

Inherits:
Base
  • Object
show all
Defined in:
lib/steep/diagnostic/deprecated/unknown_constant_assigned.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#location, #node

Instance Method Summary collapse

Methods inherited from Base

#detail_lines, #diagnostic_code

Methods included from Helper

#error_name, #full_message

Constructor Details

#initialize(node:, context:, name:) ⇒ UnknownConstantAssigned

Returns a new instance of UnknownConstantAssigned.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/steep/diagnostic/deprecated/unknown_constant_assigned.rb', line 10

def initialize(node:, context:, name:)
  const = node.children[0]
  loc = if const
          const.loc.expression.join(node.loc.name)
        else
          node.loc.name
        end
  super(node: node, location: loc)
  @context = context
  @name = name
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



7
8
9
# File 'lib/steep/diagnostic/deprecated/unknown_constant_assigned.rb', line 7

def context
  @context
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/steep/diagnostic/deprecated/unknown_constant_assigned.rb', line 8

def name
  @name
end

Instance Method Details

#header_lineObject



22
23
24
# File 'lib/steep/diagnostic/deprecated/unknown_constant_assigned.rb', line 22

def header_line
  "Cannot find the declaration of constant `#{name}`"
end