Class: Solargraph::ApiMap::Index

Inherits:
Object
  • Object
show all
Defined in:
lib/solargraph/api_map/index.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pins = []) ⇒ Index

Returns a new instance of Index.

Parameters:



7
8
9
# File 'lib/solargraph/api_map/index.rb', line 7

def initialize pins = []
  catalog pins
end

Instance Attribute Details

#extend_referencesHash{String => Array<Pin::Reference::Extend>}

Returns:



46
47
48
# File 'lib/solargraph/api_map/index.rb', line 46

def extend_references
  @extend_references ||= Hash.new { |h, k| h[k] = [] }
end

#include_referencesHash{String => Array<Pin::Reference::Include>}

Returns:



41
42
43
# File 'lib/solargraph/api_map/index.rb', line 41

def include_references
  @include_references ||= Hash.new { |h, k| h[k] = [] }
end

#namespace_hashHash{String => Array<Pin::Namespace>}

Returns:



17
18
19
# File 'lib/solargraph/api_map/index.rb', line 17

def namespace_hash
  @namespace_hash ||= Hash.new { |h, k| h[k] = [] }
end

#path_pin_hashHash{String => Array<Pin::Base>}

Returns:



27
28
29
# File 'lib/solargraph/api_map/index.rb', line 27

def path_pin_hash
  @path_pin_hash ||= Hash.new { |h, k| h[k] = [] }
end

#pin_class_hashHash{String => Array<Pin::Base>}

Returns:



22
23
24
# File 'lib/solargraph/api_map/index.rb', line 22

def pin_class_hash
  @pin_class_hash ||= Hash.new { |h, k| h[k] = [] }
end

#pinsArray<Pin::Base>

Returns:



12
13
14
# File 'lib/solargraph/api_map/index.rb', line 12

def pins
  @pins ||= []
end

#prepend_referencesHash{String => Array<Pin::Reference::Prepend>}

Returns:



51
52
53
# File 'lib/solargraph/api_map/index.rb', line 51

def prepend_references
  @prepend_references ||= Hash.new { |h, k| h[k] = [] }
end

#superclass_referencesHash{String => Array<Pin::Reference::Superclass>}

Returns:



56
57
58
# File 'lib/solargraph/api_map/index.rb', line 56

def superclass_references
  @superclass_references ||= Hash.new { |h, k| h[k] = [] }
end

Instance Method Details

#merge(pins) ⇒ Object

Parameters:



61
62
63
# File 'lib/solargraph/api_map/index.rb', line 61

def merge pins
  deep_clone.catalog pins
end

#pins_by_class(klass) ⇒ Set<generic<T>>

Parameters:

  • klass (Class<generic<T>>)

Returns:

  • (Set<generic<T>>)


34
35
36
37
38
# File 'lib/solargraph/api_map/index.rb', line 34

def pins_by_class klass
  # @type [Set<Solargraph::Pin::Base>]
  s = Set.new
  @pin_select_cache[klass] ||= pin_class_hash.each_with_object(s) { |(key, o), n| n.merge(o) if key <= klass }
end