Class: RBI::Module

Inherits:
Scope show all
Extended by:
T::Sig
Defined in:
lib/rbi/model.rb,
lib/rbi/rewriters/merge_trees.rb

Instance Attribute Summary collapse

Attributes inherited from Tree

#nodes

Attributes inherited from NodeWithComments

#comments

Attributes inherited from Node

#loc, #parent_tree

Instance Method Summary collapse

Methods inherited from Scope

#dup_empty, #index_ids, #to_s

Methods included from Indexable

#index_ids

Methods inherited from Tree

#<<, #add_sig_templates!, #annotate!, #deannotate!, #empty?, #filter_versions!, #group_nodes!, #index, #merge, #nest_non_public_methods!, #nest_singleton_methods!, #replace_attributes_with_methods!, #sort_nodes!

Methods inherited from NodeWithComments

#annotations, #merge_with, #version_requirements

Methods inherited from Node

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

Constructor Details

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

Returns a new instance of Module.



206
207
208
209
210
# File 'lib/rbi/model.rb', line 206

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

Instance Attribute Details

#nameObject

Returns the value of attribute name.



196
197
198
# File 'lib/rbi/model.rb', line 196

def name
  @name
end

Instance Method Details

#compatible_with?(other) ⇒ Boolean

Returns:

  • (Boolean)


387
388
389
# File 'lib/rbi/rewriters/merge_trees.rb', line 387

def compatible_with?(other)
  other.is_a?(Module)
end

#fully_qualified_nameObject



213
214
215
216
217
# File 'lib/rbi/model.rb', line 213

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

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