Class: Steep::Diagnostic::Signature::MixinClassError

Inherits:
Base
  • Object
show all
Defined in:
lib/steep/diagnostic/signature.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#location

Instance Method Summary collapse

Methods inherited from Base

#detail_lines, #diagnostic_code, #path

Methods included from Helper

#error_name, #full_message

Constructor Details

#initialize(location:, member:, type_name:) ⇒ MixinClassError

Returns a new instance of MixinClassError.



339
340
341
342
343
# File 'lib/steep/diagnostic/signature.rb', line 339

def initialize(location:, member:, type_name:)
  super(location: location)
  @member = member
  @type_name = type_name
end

Instance Attribute Details

#memberObject (readonly)

Returns the value of attribute member.



336
337
338
# File 'lib/steep/diagnostic/signature.rb', line 336

def member
  @member
end

#type_nameObject (readonly)

Returns the value of attribute type_name.



337
338
339
# File 'lib/steep/diagnostic/signature.rb', line 337

def type_name
  @type_name
end

Instance Method Details

#header_lineObject



345
346
347
348
349
350
351
352
353
# File 'lib/steep/diagnostic/signature.rb', line 345

def header_line
  member_name = case member
                when RBS::AST::Members::Include, RBS::AST::Members::Extend, RBS::AST::Members::Prepend
                  member.name
                when RBS::AST::Ruby::Members::IncludeMember, RBS::AST::Ruby::Members::ExtendMember, RBS::AST::Ruby::Members::PrependMember
                  member.module_name
                end
  "Cannot #{mixin_name} a class `#{member_name}` in the definition of `#{type_name}`"
end