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:



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

def initialize pins = []
  catalog pins
end

Instance Attribute Details

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

Returns:



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

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:



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

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

#macro_method_name_pinsHash{String => Array<Pin::Method>}

Returns:



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

def macro_method_name_pins
  @macro_method_name_pins
end

#macro_method_namesArray<String>

Returns:

  • (Array<String>)


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

def macro_method_names
  @macro_method_names
end

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

Returns:



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

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:



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

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:



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

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:



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

def pins
  @pins ||= []
end

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

Returns:



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

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:



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

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:



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

def alias_hash
  @alias_hash ||= {}
end

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

Returns:



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

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)


97
98
99
# File 'lib/solargraph/api_map/index.rb', line 97

def merge pins
  deep_clone.catalog pins
end

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

Parameters:

  • klass (Class<generic<T>>)

Returns:

  • (Set<generic<T>>)


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

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