Class: Solargraph::RbsMap::CoreMap

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

Overview

Ruby core pins

Instance Method Summary collapse

Methods included from Conversions

#pins

Constructor Details

#initializeCoreMap

Returns a new instance of CoreMap.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/solargraph/rbs_map/core_map.rb', line 10

def initialize
  cache = Cache.load('core.ser')
  if cache
    pins.replace cache
  else
    loader = RBS::EnvironmentLoader.new(repository: RBS::Repository.new(no_stdlib: false))
    RBS::Environment.from_loader(loader).resolve_type_names
    load_environment_to_pins(loader)
    pins.concat RbsMap::CoreFills::ALL
    processed = ApiMap::Store.new(pins).pins.reject { |p| p.is_a?(Solargraph::Pin::Reference::Override) }
    processed.each { |pin| pin.source = :rbs }
    pins.replace processed

    Cache.save('core.ser', pins)
  end
end