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

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/rbs/collection/sources/stdlib.rb

Overview

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

Instance Method Summary collapse

Instance Method Details

#has?(config_entry) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/rbs/collection/sources/stdlib.rb', line 10

def has?(config_entry)
  gem_dir(config_entry).exist?
end

#install(dest:, config_entry:, stdout:) ⇒ Object



18
19
20
21
22
23
24
# File '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

#to_lockfileObject



26
27
28
29
30
# File 'lib/rbs/collection/sources/stdlib.rb', line 26

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

#versions(config_entry) ⇒ Object



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

def versions(config_entry)
  gem_dir(config_entry).glob('*/').map { |path| path.basename.to_s }
end