Class: RBI::TypeMember

Inherits:
NodeWithComments show all
Extended by:
T::Sig
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, #merge_with, #version_requirements

Methods inherited from Node

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

Constructor Details

#initialize(name, value, loc: nil, comments: [], &block) ⇒ TypeMember

Returns a new instance of TypeMember.



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

def initialize(name, value, loc: nil, comments: [], &block)
  super(loc: loc, comments: comments)
  @name = name
  @value = value
  block&.call(self)
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



1404
1405
1406
# File 'lib/rbi/model.rb', line 1404

def name
  @name
end

#valueObject (readonly)

Returns the value of attribute value.



1404
1405
1406
# File 'lib/rbi/model.rb', line 1404

def value
  @value
end

Instance Method Details

#fully_qualified_nameObject



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

def fully_qualified_name
  return name if name.start_with?("::")

  "#{parent_scope&.fully_qualified_name}::#{name}"
end

#index_idsObject



183
184
185
# File 'lib/rbi/index.rb', line 183

def index_ids
  [to_s]
end

#to_sObject



1430
1431
1432
# File 'lib/rbi/model.rb', line 1430

def to_s
  fully_qualified_name
end