Class: Steep::Diagnostic::Signature::RecursiveAncestor
- Defined in:
- lib/steep/diagnostic/signature.rb
Instance Attribute Summary collapse
-
#ancestors ⇒ Object
readonly
Returns the value of attribute ancestors.
Attributes inherited from Base
Instance Method Summary collapse
- #header_line ⇒ Object
-
#initialize(ancestors:, location:) ⇒ RecursiveAncestor
constructor
A new instance of RecursiveAncestor.
Methods inherited from Base
#detail_lines, #diagnostic_code, #path
Methods included from Helper
Constructor Details
#initialize(ancestors:, location:) ⇒ RecursiveAncestor
Returns a new instance of RecursiveAncestor.
188 189 190 191 |
# File 'lib/steep/diagnostic/signature.rb', line 188 def initialize(ancestors:, location:) super(location: location) @ancestors = ancestors end |
Instance Attribute Details
#ancestors ⇒ Object (readonly)
Returns the value of attribute ancestors.
186 187 188 |
# File 'lib/steep/diagnostic/signature.rb', line 186 def ancestors @ancestors end |
Instance Method Details
#header_line ⇒ Object
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
# File 'lib/steep/diagnostic/signature.rb', line 193 def header_line names = ancestors.map do |ancestor| case ancestor when RBS::Definition::Ancestor::Singleton "singleton(#{ancestor.name})" when RBS::Definition::Ancestor::Instance if ancestor.args.empty? ancestor.name.to_s else "#{ancestor.name}[#{ancestor.args.join(", ")}]" end end end "Circular inheritance/mix-in is detected: #{names.join(" <: ")}" end |