Class: Solargraph::RbsMap::CoreMap

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/solargraph/rbs_map/core_map.rb

Overview

Ruby core pins

Constant Summary collapse

FILLS_DIRECTORY =
File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'rbs', 'fills'))

Constants included from Logging

Logging::DEFAULT_LOG_LEVEL, Logging::LOG_LEVELS

Instance Method Summary collapse

Methods included from Logging

logger

Constructor Details

#initializeCoreMap

Returns a new instance of CoreMap.



16
# File 'lib/solargraph/rbs_map/core_map.rb', line 16

def initialize; end

Instance Method Details

#pinsEnumerable<Pin::Base>

Returns:



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/solargraph/rbs_map/core_map.rb', line 19

def pins
  return @pins if @pins

  @pins = []
  cache = PinCache.deserialize_core
  if cache
    @pins.replace cache
  else
    @pins.concat conversions.pins

    # Avoid RBS::DuplicatedDeclarationError by loading in a different EnvironmentLoader
    fill_loader = RBS::EnvironmentLoader.new(core_root: nil, repository: RBS::Repository.new(no_stdlib: false))
    fill_loader.add(path: Pathname(FILLS_DIRECTORY))
    fill_conversions = Conversions.new(loader: fill_loader)
    @pins.concat fill_conversions.pins

    @pins.concat RbsMap::CoreFills::ALL

    processed = ApiMap::Store.new(pins).pins.reject { |p| p.is_a?(Solargraph::Pin::Reference::Override) }
    @pins.replace processed

    PinCache.serialize_core @pins
  end
  @pins
end

#resolved?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/solargraph/rbs_map/core_map.rb', line 10

def resolved?
  true
end