Class: Solargraph::RbsMap
- Inherits:
-
Object
- Object
- Solargraph::RbsMap
- Includes:
- Conversions
- Defined in:
- lib/solargraph/rbs_map.rb,
lib/solargraph/rbs_map/core_map.rb,
lib/solargraph/rbs_map/core_fills.rb,
lib/solargraph/rbs_map/stdlib_map.rb,
lib/solargraph/rbs_map/conversions.rb
Direct Known Subclasses
Defined Under Namespace
Modules: Conversions, CoreFills Classes: CoreMap, StdlibMap
Constant Summary collapse
- @@rbs_maps_hash =
{}
Constants included from Logging
Logging::DEFAULT_LOG_LEVEL, Logging::LOG_LEVELS
Instance Attribute Summary collapse
-
#library ⇒ Object
readonly
Returns the value of attribute library.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(library, version = nil, directories: []) ⇒ RbsMap
constructor
A new instance of RbsMap.
- #path_pin(path, klass = Pin::Base) ⇒ generic<T>?
- #path_pins(path) ⇒ Array<Pin::Base>
- #repository ⇒ Object
- #resolved? ⇒ Boolean
Methods included from Conversions
Methods included from Logging
Constructor Details
#initialize(library, version = nil, directories: []) ⇒ RbsMap
Returns a new instance of RbsMap.
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/solargraph/rbs_map.rb', line 23 def initialize library, version = nil, directories: [] @library = library @version = version @collection = nil @directories = directories loader = RBS::EnvironmentLoader.new(core_root: nil, repository: repository) add_library loader, library, version return unless resolved? load_environment_to_pins(loader) end |
Instance Attribute Details
#library ⇒ Object (readonly)
Returns the value of attribute library.
18 19 20 |
# File 'lib/solargraph/rbs_map.rb', line 18 def library @library end |
Class Method Details
Instance Method Details
#path_pin(path, klass = Pin::Base) ⇒ generic<T>?
38 39 40 41 |
# File 'lib/solargraph/rbs_map.rb', line 38 def path_pin path, klass = Pin::Base pin = pins.find { |p| p.path == path } pin if pin&.is_a?(klass) end |
#path_pins(path) ⇒ Array<Pin::Base>
45 46 47 |
# File 'lib/solargraph/rbs_map.rb', line 45 def path_pins path pins.select { |p| p.path == path } end |
#repository ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/solargraph/rbs_map.rb', line 53 def repository @repository ||= RBS::Repository.new(no_stdlib: false).tap do |repo| # @todo Temporarily ignoring external directories due to issues with # incomplete/broken gem_rbs_collection installations # @directories.each { |dir| repo.add(Pathname.new(dir)) } end end |
#resolved? ⇒ Boolean
49 50 51 |
# File 'lib/solargraph/rbs_map.rb', line 49 def resolved? @resolved end |