Class: Steep::Diagnostic::Ruby::UndeclaredMethodDefinition

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(method_name:, type_name:, node:) ⇒ UndeclaredMethodDefinition

Returns a new instance of UndeclaredMethodDefinition.



983
984
985
986
987
# File 'lib/steep/diagnostic/ruby.rb', line 983

def initialize(method_name:, type_name:, node:)
  @method_name = method_name
  @type_name = type_name
  super(node: node, location: (_ = node.loc).name)
end

Instance Attribute Details

#method_nameObject (readonly)

Returns the value of attribute method_name.



981
982
983
# File 'lib/steep/diagnostic/ruby.rb', line 981

def method_name
  @method_name
end

#type_nameObject (readonly)

Returns the value of attribute type_name.



981
982
983
# File 'lib/steep/diagnostic/ruby.rb', line 981

def type_name
  @type_name
end

Instance Method Details

#header_lineObject



989
990
991
992
993
994
995
996
997
998
999
1000
# File 'lib/steep/diagnostic/ruby.rb', line 989

def header_line
  name =
      case node.type
      when :def
        "#{type_name}##{method_name}"
      when :defs
        "#{type_name}.#{method_name}"
      else
        raise
      end
  "Method `#{name}` is not declared in RBS"
end