class RBS::Collection::Sources::Stdlib

signatures that are bundled in rbs gem under the stdlib/ directory

Public Instance Methods

has?(config_entry) click to toggle source
# File rbs-2.1.0/lib/rbs/collection/sources/stdlib.rb, line 10
def has?(config_entry)
  gem_dir(config_entry).exist?
end
install(dest:, config_entry:, stdout:) click to toggle source
# File rbs-2.1.0/lib/rbs/collection/sources/stdlib.rb, line 18
def install(dest:, config_entry:, stdout:)
  # Do nothing because stdlib RBS is available by default
  name = config_entry['name']
  version = config_entry['version'] or raise
  from = gem_dir(config_entry) / version
  stdout.puts "Using #{name}:#{version} (#{from})"
end
manifest_of(config_entry) click to toggle source
# File rbs-2.1.0/lib/rbs/collection/sources/stdlib.rb, line 26
def manifest_of(config_entry)
  version = config_entry['version'] or raise
  manifest_path = gem_dir(config_entry).join(version, 'manifest.yaml')
  YAML.safe_load(manifest_path.read) if manifest_path.exist?
end
to_lockfile() click to toggle source
# File rbs-2.1.0/lib/rbs/collection/sources/stdlib.rb, line 32
def to_lockfile
  {
    'type' => 'stdlib',
  }
end
versions(config_entry) click to toggle source
# File rbs-2.1.0/lib/rbs/collection/sources/stdlib.rb, line 14
def versions(config_entry)
  gem_dir(config_entry).glob('*/').map { |path| path.basename.to_s }
end

Private Instance Methods

gem_dir(config_entry) click to toggle source
# File rbs-2.1.0/lib/rbs/collection/sources/stdlib.rb, line 38
        def gem_dir(config_entry)
  Repository::DEFAULT_STDLIB_ROOT.join(config_entry['name'])
end