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

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<String>}

Returns:

  • (Hash{String => Array<String>})


64
65
66
67
68
# File 'lib/solargraph/api_map/index.rb', line 64

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

#include_referencesHash{String => Array<String>}

Returns:

  • (Hash{String => Array<String>})


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

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<String>}

Returns:

  • (Hash{String => Array<String>})


71
72
73
74
75
# File 'lib/solargraph/api_map/index.rb', line 71

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

#superclass_referencesHash{String => Array<String>}

Returns:

  • (Hash{String => Array<String>})


78
79
80
81
82
# File 'lib/solargraph/api_map/index.rb', line 78

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

Instance Method Details

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

Returns:



57
58
59
60
61
# File 'lib/solargraph/api_map/index.rb', line 57

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)


86
87
88
# File 'lib/solargraph/api_map/index.rb', line 86

def merge pins
  deep_clone.catalog pins
end

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

Parameters:

  • klass (Class<generic<T>>)

Returns:

  • (Set<generic<T>>)


42
43
44
45
46
47
# File 'lib/solargraph/api_map/index.rb', line 42

def pins_by_class klass
  # @type [Set<Solargraph::Pin::Base>]
  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