Class: RubyIndexer::Entry::Namespace

Inherits:
RubyIndexer::Entry show all
Extended by:
T::Helpers, T::Sig
Defined in:
lib/ruby_indexer/lib/ruby_indexer/entry.rb

Direct Known Subclasses

Class, Module

Instance Attribute Summary collapse

Attributes inherited from RubyIndexer::Entry

#comments, #file_path, #location, #name, #visibility

Instance Method Summary collapse

Methods inherited from RubyIndexer::Entry

#file_name, #private?, #protected?, #public?

Constructor Details

#initialize(nesting, file_path, location, name_location, comments) ⇒ Namespace

Returns a new instance of Namespace.



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/ruby_indexer/lib/ruby_indexer/entry.rb', line 122

def initialize(nesting, file_path, location, name_location, comments)
  @name = T.let(nesting.join("::"), String)
  # The original nesting where this namespace was discovered
  @nesting = nesting

  super(@name, file_path, location, comments)

  @name_location = T.let(
    if name_location.is_a?(Prism::Location)
      Location.new(
        name_location.start_line,
        name_location.end_line,
        name_location.start_column,
        name_location.end_column,
      )
    else
      name_location
    end,
    RubyIndexer::Location,
  )
end

Instance Attribute Details

#name_locationObject (readonly)

Returns the value of attribute name_location.



111
112
113
# File 'lib/ruby_indexer/lib/ruby_indexer/entry.rb', line 111

def name_location
  @name_location
end

#nestingObject (readonly)

Returns the value of attribute nesting.



107
108
109
# File 'lib/ruby_indexer/lib/ruby_indexer/entry.rb', line 107

def nesting
  @nesting
end

Instance Method Details

#ancestor_hashObject



158
159
160
# File 'lib/ruby_indexer/lib/ruby_indexer/entry.rb', line 158

def ancestor_hash
  mixin_operation_module_names.hash
end

#mixin_operation_module_namesObject



145
146
147
# File 'lib/ruby_indexer/lib/ruby_indexer/entry.rb', line 145

def mixin_operation_module_names
  mixin_operations.map(&:module_name)
end

#mixin_operationsObject



153
154
155
# File 'lib/ruby_indexer/lib/ruby_indexer/entry.rb', line 153

def mixin_operations
  @mixin_operations ||= T.let([], T.nilable(T::Array[ModuleOperation]))
end