Class: Steep::Diagnostic::Ruby::UnknownConstant

Inherits:
Base
  • Object
show all
Defined in:
lib/steep/diagnostic/ruby.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:, name:) ⇒ UnknownConstant

Returns a new instance of UnknownConstant.



609
610
611
612
613
# File 'lib/steep/diagnostic/ruby.rb', line 609

def initialize(node:, name:)
  super(node: node, location: node.loc.name) # steep:ignore NoMethod
  @name = name
  @kind = :constant
end

Instance Attribute Details

#kindObject (readonly)

Returns the value of attribute kind.



607
608
609
# File 'lib/steep/diagnostic/ruby.rb', line 607

def kind
  @kind
end

#nameObject (readonly)

Returns the value of attribute name.



606
607
608
# File 'lib/steep/diagnostic/ruby.rb', line 606

def name
  @name
end

Instance Method Details

#class!Object



615
616
617
618
# File 'lib/steep/diagnostic/ruby.rb', line 615

def class!
  @kind = :class
  self
end

#header_lineObject



625
626
627
# File 'lib/steep/diagnostic/ruby.rb', line 625

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

#module!Object



620
621
622
623
# File 'lib/steep/diagnostic/ruby.rb', line 620

def module!
  @kind = :module
  self
end