Class: Steep::Diagnostic::Ruby::ClassModuleMismatch
- Defined in:
- lib/steep/diagnostic/ruby.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from Base
Instance Method Summary collapse
- #header_line ⇒ Object
-
#initialize(node:, name:) ⇒ ClassModuleMismatch
constructor
A new instance of ClassModuleMismatch.
Methods inherited from Base
#detail_lines, #diagnostic_code
Methods included from Helper
Constructor Details
#initialize(node:, name:) ⇒ ClassModuleMismatch
Returns a new instance of ClassModuleMismatch.
415 416 417 418 419 420 421 422 423 424 425 |
# File 'lib/steep/diagnostic/ruby.rb', line 415 def initialize(node:, name:) case node.type when :module, :class location = node.loc.name # steep:ignore NoMethod else raise "Unexpected node: #{node.type}" end super(node: node, location: location) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
413 414 415 |
# File 'lib/steep/diagnostic/ruby.rb', line 413 def name @name end |
Instance Method Details
#header_line ⇒ Object
427 428 429 430 431 432 433 434 435 436 |
# File 'lib/steep/diagnostic/ruby.rb', line 427 def header_line case node&.type when :module "#{name} is declared as a class in RBS" when :class "#{name} is declared as a module in RBS" else raise end end |