Sha256: a09f51897159eea60e5046ad79a45bd260d15e6ce6ffc9a38ad9dfcbdfa134fd

Contents?: true

Size: 973 Bytes

Versions: 12

Compression:

Stored size: 973 Bytes

Contents

require 'singleton'

module RBS
  module Collection
    module Sources
      # signatures that are bundled in rbs gem under the stdlib/ directory
      class Stdlib
        include Singleton

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

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

        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

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

        private def gem_dir(config_entry)
          Repository::DEFAULT_STDLIB_ROOT.join(config_entry['name'])
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rbs-1.8.1 lib/rbs/collection/sources/stdlib.rb
rbs-1.8.0 lib/rbs/collection/sources/stdlib.rb
rbs-1.7.1 lib/rbs/collection/sources/stdlib.rb
rbs-1.7.0 lib/rbs/collection/sources/stdlib.rb
rbs-1.7.0.beta.5 lib/rbs/collection/sources/stdlib.rb
rbs-1.7.0.beta.4 lib/rbs/collection/sources/stdlib.rb
rbs-1.7.0.beta.3 lib/rbs/collection/sources/stdlib.rb
rbs-1.7.0.beta.2 lib/rbs/collection/sources/stdlib.rb
rbs-1.7.0.beta.1 lib/rbs/collection/sources/stdlib.rb
rbs-1.6.2 lib/rbs/collection/sources/stdlib.rb
rbs-1.6.1 lib/rbs/collection/sources/stdlib.rb
rbs-1.6.0 lib/rbs/collection/sources/stdlib.rb