Class: Solargraph::ApiMap::Index

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

Constant Summary

Constants included from Logging

Logging::DEFAULT_LOG_LEVEL, Logging::LOG_LEVELS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logging

log_level, logger

Constructor Details

#initialize(pins = []) ⇒ Index

Returns a new instance of Index.

Parameters:



9
10
11
# File 'lib/solargraph/api_map/index.rb', line 9

def initialize pins = []
  catalog pins
end

Instance Attribute Details

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

Returns:



69
70
71
72
73
# File 'lib/solargraph/api_map/index.rb', line 69

def extend_references
  # @param h [String]
  # @param k [Array<String>]
  @extend_references ||= Hash.new { |h, k| h[k] = [] }
end

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

Returns:



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

def include_references
  # @param h [String]
  # @param k [Array<String>]
  @include_references ||= Hash.new { |h, k| h[k] = [] }
end

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

Returns:



19
20
21
22
23
# File 'lib/solargraph/api_map/index.rb', line 19

def namespace_hash
  # @param h [String]
  # @param k [Array<Pin::Namespace>]
  @namespace_hash ||= Hash.new { |h, k| h[k] = [] }
end

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

Returns:



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

def path_pin_hash
  # @param h [String]
  # @param k [Array<Pin::Base>]
  @path_pin_hash ||= Hash.new { |h, k| h[k] = [] }
end

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

Returns:



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

def pin_class_hash
  # @param h [String]
  # @param k [Array<Pin::Base>]
  @pin_class_hash ||= Hash.new { |h, k| h[k] = [] }
end

#pinsArray<Pin::Base>

Returns:



14
15
16
# File 'lib/solargraph/api_map/index.rb', line 14

def pins
  @pins ||= []
end

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

Returns:



76
77
78
79
80
# File 'lib/solargraph/api_map/index.rb', line 76

def prepend_references
  # @param h [String]
  # @param k [Array<String>]
  @prepend_references ||= Hash.new { |h, k| h[k] = [] }
end

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

Returns:



83
84
85
86
87
# File 'lib/solargraph/api_map/index.rb', line 83

def superclass_references
  # @param h [String]
  # @param k [Array<String>]
  @superclass_references ||= Hash.new { |h, k| h[k] = [] }
end

Instance Method Details

#alias_hashHash{String => ComplexType}

Returns:



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

def alias_hash
  @alias_hash ||= {}
end

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

Returns:



62
63
64
65
66
# File 'lib/solargraph/api_map/index.rb', line 62

def include_reference_pins
  # @param h [String]
  # @param k [Array<Pin::Reference::Include>]
  @include_reference_pins ||= Hash.new { |h, k| h[k] = [] }
end

#merge(pins) ⇒ self

Parameters:

Returns:

  • (self)


91
92
93
# File 'lib/solargraph/api_map/index.rb', line 91

def merge pins
  deep_clone.catalog pins
end

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

Parameters:

  • klass (Class<generic<T>>)

Returns:

  • (Set<generic<T>>)


47
48
49
50
51
52
# File 'lib/solargraph/api_map/index.rb', line 47

def pins_by_class klass
  # @type [Set<generic<T>>]
  s = Set.new
  # @sg-ignore need to support destructured args in blocks
  @pin_select_cache[klass] ||= pin_class_hash.each_with_object(s) { |(key, o), n| n.merge(o) if key <= klass }
end