Class: Solargraph::RbsMap::StdlibMap

Inherits:
Solargraph::RbsMap show all
Includes:
Logging
Defined in:
lib/solargraph/rbs_map/stdlib_map.rb

Overview

Ruby stdlib pins

Constant Summary

Constants included from Logging

Logging::DEFAULT_LOG_LEVEL, Logging::LOG_LEVELS

Instance Attribute Summary

Attributes inherited from Solargraph::RbsMap

#library, #rbs_collection_config_path, #rbs_collection_paths

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Logging

logger

Methods inherited from Solargraph::RbsMap

#cache_key, from_gemspec, #path_pin, #path_pins, #pins, #repository, #resolved?

Constructor Details

#initialize(library) ⇒ StdlibMap

Returns a new instance of StdlibMap.

Parameters:

  • library (String)


16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/solargraph/rbs_map/stdlib_map.rb', line 16

def initialize library
  cached_pins = PinCache.deserialize_stdlib_require library
  if cached_pins
    @pins = cached_pins
    @resolved = true
    @loaded = true
    logger.debug { "Deserialized #{cached_pins.length} cached pins for stdlib require #{library.inspect}" }
  else
    super
    unless resolved?
      @pins = []
      logger.info { "Could not resolve #{library.inspect}" }
      return
    end
    generated_pins = pins
    logger.debug { "Found #{generated_pins.length} pins for stdlib library #{library}" }
    PinCache.serialize_stdlib_require library, generated_pins
  end
end

Class Method Details

.load(library) ⇒ StdlibMap

Parameters:

  • library (String)

Returns:



38
39
40
# File 'lib/solargraph/rbs_map/stdlib_map.rb', line 38

def self.load library
  @stdlib_maps_hash[library] ||= StdlibMap.new(library)
end