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

#location, #name, #uri, #visibility

Instance Method Summary collapse

Methods inherited from RubyIndexer::Entry

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

Constructor Details

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

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



125
126
127
128
129
130
131
132
133
# File 'lib/ruby_indexer/lib/ruby_indexer/entry.rb', line 125

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

  super(@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



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

def name_location
  @name_location
end

#nestingObject (readonly)

: Array



118
119
120
# File 'lib/ruby_indexer/lib/ruby_indexer/entry.rb', line 118

def nesting
  @nesting
end

Instance Method Details

#ancestor_hashObject

: -> Integer



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

def ancestor_hash
  mixin_operation_module_names.hash
end

#mixin_operation_module_namesObject

: -> Array



136
137
138
# File 'lib/ruby_indexer/lib/ruby_indexer/entry.rb', line 136

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



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

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