Class: Steep::Diagnostic::Ruby::MethodDefinitionMissing

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:, module_name:, kind:, missing_method:) ⇒ MethodDefinitionMissing

Returns a new instance of MethodDefinitionMissing.



572
573
574
575
576
577
# File 'lib/steep/diagnostic/ruby.rb', line 572

def initialize(node:, module_name:, kind:, missing_method:)
  super(node: node, location: node.children[0].loc.expression)
  @module_name = module_name
  @kind = kind
  @missing_method = missing_method
end

Instance Attribute Details

#kindObject (readonly)

Returns the value of attribute kind.



569
570
571
# File 'lib/steep/diagnostic/ruby.rb', line 569

def kind
  @kind
end

#missing_methodObject (readonly)

Returns the value of attribute missing_method.



570
571
572
# File 'lib/steep/diagnostic/ruby.rb', line 570

def missing_method
  @missing_method
end

#module_nameObject (readonly)

Returns the value of attribute module_name.



568
569
570
# File 'lib/steep/diagnostic/ruby.rb', line 568

def module_name
  @module_name
end

Instance Method Details

#header_lineObject



579
580
581
582
583
584
585
586
587
# File 'lib/steep/diagnostic/ruby.rb', line 579

def header_line
  method_name = case kind
                when :module
                  ".#{missing_method}"
                when :instance
                  "##{missing_method}"
                end
  "Cannot find implementation of method `#{module_name}#{method_name}`"
end