Class: Solargraph::LiveMap::Cache

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

Instance Method Summary collapse

Constructor Details

#initializeCache

Returns a new instance of Cache.



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

def initialize
  @method_cache = {}
  @constant_cache = {}
  @path_cache = {}
end

Instance Method Details

#clearObject



31
32
33
34
35
# File 'lib/solargraph/live_map/cache.rb', line 31

def clear
  @method_cache.clear
  @constant_cache.clear
  @path_cache.clear
end

#get_constants(namespace, root) ⇒ Object



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

def get_constants namespace, root
  @constant_cache[[namespace, root]]
end

#get_methods(options) ⇒ Object



10
11
12
# File 'lib/solargraph/live_map/cache.rb', line 10

def get_methods options
  @method_cache[options]
end

#get_path_pin(path) ⇒ Object



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

def get_path_pin path
  @path_cache[path]
end

#set_constants(namespace, root, values) ⇒ Object



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

def set_constants namespace, root, values
  @constant_cache[[namespace, root]] = values
end

#set_methods(options, values) ⇒ Object



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

def set_methods options, values
  @method_cache[options] = values
  values.each { |pin| @path_cache[pin.path] = pin }
end