Module: Solargraph::Collection

Defined in:
lib/solargraph/collection.rb,
lib/solargraph/collection/gem.rb,
lib/solargraph/collection/base.rb,
lib/solargraph/collection/core.rb,
lib/solargraph/collection/stdlib.rb

Defined Under Namespace

Classes: Base, Core, Gem, Stdlib

Class Method Summary collapse

Class Method Details

.cached(key) ⇒ Array<Pin::Base>

The pins cached under a key, storing the block result on a miss.

Parameters:

  • key (String)

Returns:



21
22
23
# File 'lib/solargraph/collection.rb', line 21

def self.cached key
  mem_cache.fetch(key) { mem_cache[key] = yield }
end

.clear_mem_cache ⇒ void

This method returns an undefined value.



26
27
28
# File 'lib/solargraph/collection.rb', line 26

def self.clear_mem_cache
  mem_cache.clear
end

.mem_cache ⇒ Hash{String => Array<Pin::Base>}

A hash for storing pin collections in memory.

Returns:



13
14
15
# File 'lib/solargraph/collection.rb', line 13

def self.mem_cache
  @mem_cache ||= {}
end