Class: Solargraph::ApiMap::Cache
- Inherits:
-
Object
- Object
- Solargraph::ApiMap::Cache
- Defined in:
- lib/solargraph/api_map/cache.rb
Instance Method Summary collapse
- #clear ⇒ void
- #empty? ⇒ Boolean
- #get_clip(cursor) ⇒ SourceMap::Clip?
- #get_constants(namespace, contexts) ⇒ Array<Pin::Base>
- #get_methods(fqns, scope, visibility, deep) ⇒ Array<Pin::Method>
- #get_qualified_namespace(name, context) ⇒ String
- #get_receiver_definition(path) ⇒ Pin::Method
-
#initialize ⇒ Cache
constructor
A new instance of Cache.
- #set_clip(cursor, clip) ⇒ Object
- #set_constants(namespace, contexts, value) ⇒ void
- #set_methods(fqns, scope, visibility, deep, value) ⇒ void
- #set_qualified_namespace(name, context, value) ⇒ void
- #set_receiver_definition(path, pin) ⇒ void
Constructor Details
#initialize ⇒ Cache
Returns a new instance of Cache.
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/solargraph/api_map/cache.rb', line 6 def initialize # @type [Hash{Array => Array<Pin::Method>}] @methods = {} # @type [Hash{(String, Array<String>) => Array<Pin::Base>}] @constants = {} # @type [Hash{(String, String) => String}] @qualified_namespaces = {} # @type [Hash{String => Pin::Method}] @receiver_definitions = {} # @type [Hash{String => SourceMap::Clip}] @clips = {} end |
Instance Method Details
#clear ⇒ void
This method returns an undefined value.
94 95 96 |
# File 'lib/solargraph/api_map/cache.rb', line 94 def clear all_caches.each(&:clear) end |
#empty? ⇒ Boolean
99 100 101 |
# File 'lib/solargraph/api_map/cache.rb', line 99 def empty? all_caches.all?(&:empty?) end |
#get_clip(cursor) ⇒ SourceMap::Clip?
83 84 85 |
# File 'lib/solargraph/api_map/cache.rb', line 83 def get_clip(cursor) @clips["#{cursor.filename}|#{cursor.range.inspect}|#{cursor.node&.to_sexp}"] end |
#get_constants(namespace, contexts) ⇒ Array<Pin::Base>
41 42 43 |
# File 'lib/solargraph/api_map/cache.rb', line 41 def get_constants namespace, contexts @constants["#{namespace}|#{contexts}"] end |
#get_methods(fqns, scope, visibility, deep) ⇒ Array<Pin::Method>
24 25 26 |
# File 'lib/solargraph/api_map/cache.rb', line 24 def get_methods fqns, scope, visibility, deep @methods["#{fqns}|#{scope}|#{visibility}|#{deep}"] end |
#get_qualified_namespace(name, context) ⇒ String
56 57 58 |
# File 'lib/solargraph/api_map/cache.rb', line 56 def get_qualified_namespace name, context @qualified_namespaces["#{name}|#{context}"] end |
#get_receiver_definition(path) ⇒ Pin::Method
70 71 72 |
# File 'lib/solargraph/api_map/cache.rb', line 70 def get_receiver_definition path @receiver_definitions[path] end |
#set_clip(cursor, clip) ⇒ Object
89 90 91 |
# File 'lib/solargraph/api_map/cache.rb', line 89 def set_clip(cursor, clip) @clips["#{cursor.filename}|#{cursor.range.inspect}|#{cursor.node&.to_sexp}"] = clip end |
#set_constants(namespace, contexts, value) ⇒ void
This method returns an undefined value.
49 50 51 |
# File 'lib/solargraph/api_map/cache.rb', line 49 def set_constants namespace, contexts, value @constants["#{namespace}|#{contexts}"] = value end |
#set_methods(fqns, scope, visibility, deep, value) ⇒ void
This method returns an undefined value.
34 35 36 |
# File 'lib/solargraph/api_map/cache.rb', line 34 def set_methods fqns, scope, visibility, deep, value @methods["#{fqns}|#{scope}|#{visibility}|#{deep}"] = value end |
#set_qualified_namespace(name, context, value) ⇒ void
This method returns an undefined value.
64 65 66 |
# File 'lib/solargraph/api_map/cache.rb', line 64 def set_qualified_namespace name, context, value @qualified_namespaces["#{name}|#{context}"] = value end |
#set_receiver_definition(path, pin) ⇒ void
This method returns an undefined value.
77 78 79 |
# File 'lib/solargraph/api_map/cache.rb', line 77 def set_receiver_definition path, pin @receiver_definitions[path] = pin end |