Class: Steep::Diagnostic::Ruby::UnexpectedSuper

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:, method:) ⇒ UnexpectedSuper

Returns a new instance of UnexpectedSuper.



553
554
555
556
# File 'lib/steep/diagnostic/ruby.rb', line 553

def initialize(node:, method:)
  super(node: node)
  @method = method
end

Instance Attribute Details

#methodObject (readonly)

Returns the value of attribute method.



551
552
553
# File 'lib/steep/diagnostic/ruby.rb', line 551

def method
  @method
end

Instance Method Details

#header_lineObject



558
559
560
561
562
563
564
# File 'lib/steep/diagnostic/ruby.rb', line 558

def header_line
  if method
    "No superclass method `#{method}` defined"
  else
    "`super` is not allowed from outside of method"
  end
end