Class: Solargraph::ApiMap::Cache

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

Instance Method Summary collapse

Constructor Details

#initializeCache

Returns a new instance of Cache


4
5
6
7
8
9
# File 'lib/solargraph/api_map/cache.rb', line 4

def initialize
  @methods = {}
  @constants = {}
  @qualified_namespaces = {}
  @receiver_definitions = {}
end

Instance Method Details

#clearvoid

This method returns an undefined value.


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

def clear
  @methods.clear
  @constants.clear
  @qualified_namespaces.clear
  @receiver_definitions.clear
end

#empty?Boolean

Returns:

  • (Boolean)

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

def empty?
  @methods.empty? &&
    @constants.empty? &&
    @qualified_namespaces.empty? &&
    @receiver_definitions.empty?
end

#get_constants(namespace, context) ⇒ Object


19
20
21
# File 'lib/solargraph/api_map/cache.rb', line 19

def get_constants namespace, context
  @constants[[namespace, context]]
end

#get_methods(fqns, scope, visibility, deep) ⇒ Object


11
12
13
# File 'lib/solargraph/api_map/cache.rb', line 11

def get_methods fqns, scope, visibility, deep
  @methods[[fqns, scope, visibility.sort, deep]]
end

#get_qualified_namespace(name, context) ⇒ Object


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

def get_qualified_namespace name, context
  @qualified_namespaces[[name, context]]
end

#get_receiver_definition(path) ⇒ Object


39
40
41
# File 'lib/solargraph/api_map/cache.rb', line 39

def get_receiver_definition path
  @receiver_definitions[path]
end

#receiver_defined?(path) ⇒ Boolean

Returns:

  • (Boolean)

35
36
37
# File 'lib/solargraph/api_map/cache.rb', line 35

def receiver_defined? path
  @receiver_definitions.key? path
end

#set_constants(namespace, context, value) ⇒ Object


23
24
25
# File 'lib/solargraph/api_map/cache.rb', line 23

def set_constants namespace, context, value
  @constants[[namespace, context]] = value
end

#set_methods(fqns, scope, visibility, deep, value) ⇒ Object


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

def set_methods fqns, scope, visibility, deep, value
  @methods[[fqns, scope, visibility.sort, deep]] = value
end

#set_qualified_namespace(name, context, value) ⇒ Object


31
32
33
# File 'lib/solargraph/api_map/cache.rb', line 31

def set_qualified_namespace name, context, value
  @qualified_namespaces[[name, context]] = value
end

#set_receiver_definition(path, pin) ⇒ Object


43
44
45
# File 'lib/solargraph/api_map/cache.rb', line 43

def set_receiver_definition path, pin
  @receiver_definitions[path] = pin
end