Sha256: 01f56b9f1032cb042a714660a2fe2c6e2bd5fcfad6692c552f14843b95c7413c

Contents?: true

Size: 1.01 KB

Versions: 43

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

require_relative './sources/base'
require_relative './sources/git'
require_relative './sources/stdlib'
require_relative './sources/rubygems'
require_relative './sources/local'

module RBS
  module Collection
    module Sources
      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
    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
rbs-3.0.1 lib/rbs/collection/sources.rb
rbs-3.0.0 lib/rbs/collection/sources.rb
rbs-3.0.0.dev.3 lib/rbs/collection/sources.rb