Module: RBS::Collection::Sources

Defined in:
lib/rbs/collection/sources.rb,
lib/rbs/collection/sources/git.rb,
lib/rbs/collection/sources/base.rb,
lib/rbs/collection/sources/local.rb,
lib/rbs/collection/sources/stdlib.rb,
lib/rbs/collection/sources/rubygems.rb

Defined Under Namespace

Modules: Base Classes: Git, Local, Rubygems, Stdlib

Class Method Summary collapse

Class Method Details

.from_config_entry(source_entry, base_directory:) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/rbs/collection/sources.rb', line 12

def self.from_config_entry(source_entry, base_directory:)
  case source_entry['type']
  when 'git', nil # git source by default
    # @type var source_entry: Git::source_entry
    Git.new(
      name: source_entry["name"],
      revision: source_entry["revision"],
      remote: source_entry["remote"],
      repo_dir: source_entry["repo_dir"]
    )
  when 'local'
    # @type var source_entry: Local::source_entry
    Local.new(
      path: source_entry['path'],
      base_directory: base_directory,
    )
  when 'stdlib'
    Stdlib.instance
  when 'rubygems'
    Rubygems.instance
  else
    raise
  end
end