Class: RBI::RequiresAncestor

Inherits:
NodeWithComments show all
Includes:
Indexable
Defined in:
lib/rbi/index.rb,
lib/rbi/model.rb

Instance Attribute Summary collapse

Attributes inherited from NodeWithComments

#comments

Attributes inherited from Node

#loc, #parent_tree

Instance Method Summary collapse

Methods inherited from NodeWithComments

#annotations, #comments?, #merge_with, #version_requirements

Methods inherited from Node

#compatible_with?, #detach, #merge_with, #parent_conflict_tree, #parent_scope, #print, #rbs_print, #rbs_string, #replace, #satisfies_version?, #string

Constructor Details

#initialize(name, loc: nil, comments: nil) ⇒ RequiresAncestor

Returns a new instance of RequiresAncestor.

Signature:

  • (String name, ?loc: Loc?, ?comments: Array[Comment]?) -> void



1417
1418
1419
1420
# File 'lib/rbi/model.rb', line 1417

def initialize(name, loc: nil, comments: nil)
  super(loc: loc, comments: comments)
  @name = name.to_s #: String
end

Instance Attribute Details

#nameObject (readonly)

Signature:

  • String



1414
1415
1416
# File 'lib/rbi/model.rb', line 1414

def name
  @name
end

Instance Method Details

#index_idsObject

Signature:

  • -> Array[String]



154
155
156
# File 'lib/rbi/index.rb', line 154

def index_ids
  [to_s]
end

#to_sObject

Signature:

  • -> String



1424
1425
1426
# File 'lib/rbi/model.rb', line 1424

def to_s
  "#{parent_scope&.fully_qualified_name}.requires_ancestor(#{name})"
end