Class: Steep::Diagnostic::Ruby::LibraryRBSError

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

#diagnostic_code

Methods included from Helper

#error_name, #full_message

Constructor Details

#initialize(error:, location:) ⇒ LibraryRBSError

Returns a new instance of LibraryRBSError.



950
951
952
953
# File 'lib/steep/diagnostic/ruby.rb', line 950

def initialize(error:, location:)
  @error = error
  super(node: nil, location: location)
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



948
949
950
# File 'lib/steep/diagnostic/ruby.rb', line 948

def error
  @error
end

Instance Method Details

#detail_linesObject



959
960
961
962
963
964
965
966
967
968
969
970
971
# File 'lib/steep/diagnostic/ruby.rb', line 959

def detail_lines
  lines = [] #: Array[String]
  lines << error.header_line
  if error.location
    lines << "(#{error.location.buffer.name.to_s}:#{error.location.start_line}:#{error.location.start_column})"
  end

  if detail = error.detail_lines
    lines << "" << detail
  end

  lines.join("\n")
end

#header_lineObject



955
956
957
# File 'lib/steep/diagnostic/ruby.rb', line 955

def header_line
  "Type checking failed due to error in library RBS file"
end