Class: RBI::Scope

Inherits:
Tree show all
Extended by:
T::Helpers, T::Sig
Includes:
Indexable
Defined in:
lib/rbi/model.rb,
lib/rbi/index.rb,
lib/rbi/rewriters/merge_trees.rb

Overview

Scopes

Direct Known Subclasses

Class, Module, SingletonClass, Struct, TEnumBlock

Instance Attribute Summary

Attributes inherited from Tree

#nodes

Attributes inherited from NodeWithComments

#comments

Attributes inherited from Node

#loc, #parent_tree

Instance Method Summary collapse

Methods inherited from Tree

#<<, #add_sig_templates!, #annotate!, #deannotate!, #empty?, #filter_versions!, #flatten_singleton_methods!, #flatten_visibilities!, #group_nodes!, #index, #initialize, #merge, #nest_non_public_members!, #nest_singleton_methods!, #nest_top_level_members!, #replace_attributes_with_methods!, #sort_nodes!, #translate_rbs_sigs!

Methods inherited from NodeWithComments

#annotations, #initialize, #merge_with, #version_requirements

Methods inherited from Node

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

Constructor Details

This class inherits a constructor from RBI::Tree

Instance Method Details

#dup_emptyObject

Duplicate ‘self` scope without its body : -> self



337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
# File 'lib/rbi/rewriters/merge_trees.rb', line 337

def dup_empty
  case self
  when Module
    Module.new(name, loc: loc, comments: comments)
  when TEnum
    TEnum.new(name, loc: loc, comments: comments)
  when TEnumBlock
    TEnumBlock.new(loc: loc, comments: comments)
  when TStruct
    TStruct.new(name, loc: loc, comments: comments)
  when Class
    Class.new(name, superclass_name: superclass_name, loc: loc, comments: comments)
  when Struct
    Struct.new(name, members: members, keyword_init: keyword_init, loc: loc, comments: comments)
  when SingletonClass
    SingletonClass.new(loc: loc, comments: comments)
  else
    raise DuplicateNodeError, "Can't duplicate node #{self}"
  end
end

#fully_qualified_nameObject



173
# File 'lib/rbi/model.rb', line 173

def fully_qualified_name; end

#index_idsObject

: -> Array



89
90
91
# File 'lib/rbi/index.rb', line 89

def index_ids
  [fully_qualified_name]
end

#to_sObject

: -> String



177
178
179
# File 'lib/rbi/model.rb', line 177

def to_s
  fully_qualified_name
end