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_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.
-
#inspect ⇒ Object
avoid enormous dump.
- #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
- #to_s ⇒ Object
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}] @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.
91 92 93 94 95 |
# File 'lib/solargraph/api_map/cache.rb', line 91 def clear return if empty? all_caches.each(&:clear) end |
#empty? ⇒ Boolean
98 99 100 |
# File 'lib/solargraph/api_map/cache.rb', line 98 def empty? all_caches.all?(&:empty?) end |
#get_constants(namespace, contexts) ⇒ Array<Pin::Base>
50 51 52 |
# File 'lib/solargraph/api_map/cache.rb', line 50 def get_constants namespace, contexts @constants["#{namespace}|#{contexts}"] end |
#get_methods(fqns, scope, visibility, deep) ⇒ Array<Pin::Method>
33 34 35 |
# File 'lib/solargraph/api_map/cache.rb', line 33 def get_methods fqns, scope, visibility, deep @methods["#{fqns}|#{scope}|#{visibility}|#{deep}"] end |
#get_qualified_namespace(name, context) ⇒ String
65 66 67 |
# File 'lib/solargraph/api_map/cache.rb', line 65 def get_qualified_namespace name, context @qualified_namespaces["#{name}|#{context}"] end |
#get_receiver_definition(path) ⇒ Pin::Method
79 80 81 |
# File 'lib/solargraph/api_map/cache.rb', line 79 def get_receiver_definition path @receiver_definitions[path] end |
#inspect ⇒ Object
avoid enormous dump
24 25 26 |
# File 'lib/solargraph/api_map/cache.rb', line 24 def inspect to_s end |
#set_constants(namespace, contexts, value) ⇒ void
This method returns an undefined value.
58 59 60 |
# File 'lib/solargraph/api_map/cache.rb', line 58 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.
43 44 45 |
# File 'lib/solargraph/api_map/cache.rb', line 43 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.
73 74 75 |
# File 'lib/solargraph/api_map/cache.rb', line 73 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.
86 87 88 |
# File 'lib/solargraph/api_map/cache.rb', line 86 def set_receiver_definition path, pin @receiver_definitions[path] = pin end |
#to_s ⇒ Object
19 20 21 |
# File 'lib/solargraph/api_map/cache.rb', line 19 def to_s self.class.to_s end |