Class: Solargraph::LiveMap::Cache
- Inherits:
-
Object
- Object
- Solargraph::LiveMap::Cache
- Defined in:
- lib/solargraph/live_map/cache.rb
Instance Method Summary collapse
- #clear ⇒ Object
- #get_constants(namespace, root) ⇒ Object
- #get_methods(options) ⇒ Object
- #get_path_pin(path) ⇒ Object
-
#initialize ⇒ Cache
constructor
A new instance of Cache.
- #set_constants(namespace, root, values) ⇒ Object
- #set_methods(options, values) ⇒ Object
Constructor Details
#initialize ⇒ Cache
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
#clear ⇒ Object
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 @method_cache[] 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 , values @method_cache[] = values values.each { |pin| @path_cache[pin.path] = pin } end |