Class: Solargraph::RbsCollection
- Inherits:
-
Object
- Object
- Solargraph::RbsCollection
- Defined in:
- lib/solargraph/rbs_collection.rb
Overview
The RBS collection declared by a project's rbs_collection.lock.yaml.
Instance Attribute Summary collapse
-
#lockfile ⇒ Object
readonly
Returns the value of attribute lockfile.
Instance Method Summary collapse
- #gem_keys ⇒ Object
-
#initialize(lockfile) ⇒ RbsCollection
constructor
A new instance of RbsCollection.
- #load(metagem) ⇒ Array<Pin::Base>
-
#stdlib_names ⇒ Array<String>
The names of the stdlib signature sets declared by the collection.
Constructor Details
#initialize(lockfile) ⇒ RbsCollection
Returns a new instance of RbsCollection.
9 10 11 |
# File 'lib/solargraph/rbs_collection.rb', line 9 def initialize lockfile @lockfile = File.(lockfile) if lockfile end |
Instance Attribute Details
#lockfile ⇒ Object (readonly)
Returns the value of attribute lockfile.
7 8 9 |
# File 'lib/solargraph/rbs_collection.rb', line 7 def lockfile @lockfile end |
Instance Method Details
#gem_keys ⇒ Object
21 22 23 |
# File 'lib/solargraph/rbs_collection.rb', line 21 def gem_keys gem_path_map.keys end |
#load(metagem) ⇒ Array<Pin::Base>
15 16 17 18 19 |
# File 'lib/solargraph/rbs_collection.rb', line 15 def load key = best_key() return [] unless key mem_cache[key] ||= RbsMap::Path.pins(gem_path_map[key]) end |
#stdlib_names ⇒ Array<String>
The names of the stdlib signature sets declared by the collection.
rbs collection install resolves these to the signatures which ship
with the rbs gem instead of copying them into the collection directory,
so they can never be located by a gem name/version lookup.
32 33 34 35 |
# File 'lib/solargraph/rbs_collection.rb', line 32 def stdlib_names @stdlib_names ||= raw_data[:gems].select { |gem| gem.dig(:source, :type).to_s == 'stdlib' } .map { |gem| gem[:name].to_s }.uniq end |