Class: RubyIndexer::Entry::Namespace Abstract

Inherits:
RubyIndexer::Entry show all
Defined in:
lib/ruby_indexer/lib/ruby_indexer/entry.rb

Overview

This class is abstract.

Direct Known Subclasses

Class, Module

Instance Attribute Summary collapse

Attributes inherited from RubyIndexer::Entry

#configuration, #location, #name, #uri, #visibility

Instance Method Summary collapse

Methods inherited from RubyIndexer::Entry

#comments, #file_name, #file_path, #private?, #protected?, #public?

Constructor Details

#initialize(configuration, nesting, uri, location, name_location, comments) ⇒ Namespace

: (Configuration configuration, Array nesting, URI::Generic uri, Location location, Location name_location, String? comments) -> void



129
130
131
132
133
134
135
136
137
# File 'lib/ruby_indexer/lib/ruby_indexer/entry.rb', line 129

def initialize(configuration, nesting, uri, location, name_location, comments) # rubocop:disable Metrics/ParameterLists
  @name = nesting.join("::") #: String
  # The original nesting where this namespace was discovered
  @nesting = nesting

  super(configuration, @name, uri, location, comments)

  @name_location = name_location
end

Instance Attribute Details

#name_locationObject (readonly)

Returns the location of the constant name, excluding the parent class or the body : Location



126
127
128
# File 'lib/ruby_indexer/lib/ruby_indexer/entry.rb', line 126

def name_location
  @name_location
end

#nestingObject (readonly)

: Array



122
123
124
# File 'lib/ruby_indexer/lib/ruby_indexer/entry.rb', line 122

def nesting
  @nesting
end

Instance Method Details

#ancestor_hashObject

: -> Integer



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

def ancestor_hash
  mixin_operation_module_names.hash
end

#mixin_operation_module_namesObject

: -> Array



140
141
142
# File 'lib/ruby_indexer/lib/ruby_indexer/entry.rb', line 140

def mixin_operation_module_names
  mixin_operations.map(&:module_name)
end

#mixin_operationsObject

Stores all explicit prepend, include and extend operations in the exact order they were discovered in the source code. Maintaining the order is essential to linearize ancestors the right way when a module is both included and prepended : -> Array



148
149
150
# File 'lib/ruby_indexer/lib/ruby_indexer/entry.rb', line 148

def mixin_operations
  @mixin_operations ||= [] #: Array[ModuleOperation]?
end