Class: RBS::Collection::Sources::Stdlib
- Inherits:
-
Object
- Object
- RBS::Collection::Sources::Stdlib
- Includes:
- Base, Singleton
- Defined in:
- lib/rbs/collection/sources/stdlib.rb
Overview
signatures that are bundled in rbs gem under the stdlib/ directory
Constant Summary collapse
- REPO =
Repository.default
Instance Method Summary collapse
- #has?(name, version) ⇒ Boolean
- #install(dest:, name:, version:, stdout:) ⇒ Object
- #manifest_of(name, version) ⇒ Object
- #to_lockfile ⇒ Object
- #versions(name) ⇒ Object
Methods included from Base
Instance Method Details
#has?(name, version) ⇒ Boolean
15 16 17 |
# File 'lib/rbs/collection/sources/stdlib.rb', line 15 def has?(name, version) lookup(name, version) end |
#install(dest:, name:, version:, stdout:) ⇒ Object
23 24 25 26 27 |
# File 'lib/rbs/collection/sources/stdlib.rb', line 23 def install(dest:, name:, version:, stdout:) # Do nothing because stdlib RBS is available by default from = lookup(name, version) stdout.puts "Using #{name}:#{version} (#{from})" end |
#manifest_of(name, version) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/rbs/collection/sources/stdlib.rb', line 29 def manifest_of(name, version) unless path = lookup(name, version) RBS.logger.warn "`#{name}` is specified in rbs_collection.lock.yaml. But it is not found in #{REPO.dirs.join(",")}" return end manifest_path = path.join('manifest.yaml') YAML.safe_load(manifest_path.read) if manifest_path.exist? end |
#to_lockfile ⇒ Object
38 39 40 41 42 |
# File 'lib/rbs/collection/sources/stdlib.rb', line 38 def to_lockfile { 'type' => 'stdlib', } end |
#versions(name) ⇒ Object
19 20 21 |
# File 'lib/rbs/collection/sources/stdlib.rb', line 19 def versions(name) REPO.gems[name].versions.keys.map(&:to_s) end |