Class: Solargraph::RbsMap::StdlibMap
- Inherits:
-
RbsMap
- Object
- RbsMap
- Solargraph::RbsMap::StdlibMap
show all
- Includes:
- Logging
- Defined in:
- lib/solargraph/rbs_map/stdlib_map.rb
Overview
Constant Summary
Constants included
from Logging
Logging::DEFAULT_LOG_LEVEL, Logging::LOG_LEVELS
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Logging
log_level, logger
Constructor Details
#initialize(library, rebuild: false, out: $stderr) ⇒ StdlibMap
Returns a new instance of StdlibMap.
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/solargraph/rbs_map/stdlib_map.rb', line 19
def initialize library, rebuild: false, out: $stderr
cached_pins = PinCache.deserialize_stdlib_require library
if cached_pins && !rebuild
@pins = cached_pins
@resolved = true
@loaded = true
logger.debug { "Deserialized #{cached_pins.length} cached pins for stdlib require #{library.inspect}" }
elsif self.class.source.has? library, nil
super(library, out: out)
unless resolved?
@pins = []
logger.debug { "StdlibMap 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
66
67
68
|
# File 'lib/solargraph/rbs_map/stdlib_map.rb', line 66
def self.load library
@stdlib_maps_hash[library] ||= StdlibMap.new(library)
end
|
.source ⇒ RBS::Collection::Sources::Stdlib
40
41
42
|
# File 'lib/solargraph/rbs_map/stdlib_map.rb', line 40
def self.source
@source ||= RBS::Collection::Sources::Stdlib.instance
end
|
.stdlib_dependencies(name, version = nil) ⇒ Array<Hash{String => String}>?
47
48
49
50
51
52
53
54
55
|
# File 'lib/solargraph/rbs_map/stdlib_map.rb', line 47
def self.stdlib_dependencies name, version = nil
if source.has?(name, version)
source.dependencies_of(name, version)
else
[]
end
end
|
Instance Method Details
#resolve_dependencies? ⇒ Boolean
57
58
59
60
61
62
|
# File 'lib/solargraph/rbs_map/stdlib_map.rb', line 57
def resolve_dependencies?
true
end
|