123456789_123456789_123456789_123456789_123456789_

Class: RBS::Collection::Sources::Stdlib

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Instance Chain:
self, Singleton, Base
Inherits: Object
Defined in: lib/rbs/collection/sources/stdlib.rb

Overview

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

Constant Summary

Instance Method Summary

Instance Method Details

#has?(name, version) ⇒ Boolean

[ GitHub ]

  
# File 'lib/rbs/collection/sources/stdlib.rb', line 15

def has?(name, version)
  lookup(name, version)
end

#install(dest:, name:, version:, stdout:)

[ GitHub ]

  
# 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

#lookup(name, version) (private)

[ GitHub ]

  
# File 'lib/rbs/collection/sources/stdlib.rb', line 44

private def lookup(name, version)
  REPO.lookup(name, version)
end

#manifest_of(name, version)

[ GitHub ]

  
# 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

[ GitHub ]

  
# File 'lib/rbs/collection/sources/stdlib.rb', line 38

def to_lockfile
  {
    'type' => 'stdlib',
  }
end

#versions(name)

[ GitHub ]

  
# File 'lib/rbs/collection/sources/stdlib.rb', line 19

def versions(name)
  REPO.gems[name].versions.keys.map(&:to_s)
end