Sha256: 9d07bc27702a58f0a6be895245b20c952342d0082b692cc33322148504e9d809

Contents?: true

Size: 954 Bytes

Versions: 43

Compression:

Stored size: 954 Bytes

Contents

# typed: strict
# frozen_string_literal: true

module Tapioca
  class RepoIndex
    extend T::Sig
    extend T::Generic

    class << self
      extend T::Sig

      sig { params(json: String).returns(RepoIndex) }
      def from_json(json)
        RepoIndex.from_hash(JSON.parse(json))
      end

      sig { params(hash: T::Hash[String, T::Hash[T.untyped, T.untyped]]).returns(RepoIndex) }
      def from_hash(hash)
        hash.each_with_object(RepoIndex.new) do |(name, _), index|
          index << name
        end
      end
    end

    sig { void }
    def initialize
      @entries = T.let(Set.new, T::Set[String])
    end

    sig { params(gem_name: String).void }
    def <<(gem_name)
      @entries.add(gem_name)
    end

    sig { returns(T::Enumerable[String]) }
    def gems
      @entries.sort
    end

    sig { params(gem_name: String).returns(T::Boolean) }
    def has_gem?(gem_name)
      @entries.include?(gem_name)
    end
  end
end

Version data entries

43 entries across 43 versions & 2 rubygems

Version Path
tapioca-0.11.15 lib/tapioca/repo_index.rb
tapioca-0.11.14 lib/tapioca/repo_index.rb
tapioca-0.11.13 lib/tapioca/repo_index.rb
tapioca-0.11.12 lib/tapioca/repo_index.rb
tapioca-0.11.11 lib/tapioca/repo_index.rb
tapioca-0.11.10 lib/tapioca/repo_index.rb
tapioca-0.11.9 lib/tapioca/repo_index.rb
tapioca-0.11.8 lib/tapioca/repo_index.rb
tapioca-0.11.7 lib/tapioca/repo_index.rb
tapioca-0.11.6 lib/tapioca/repo_index.rb
tapioca-0.11.5 lib/tapioca/repo_index.rb
tapioca-0.11.4 lib/tapioca/repo_index.rb
tapioca-0.11.3 lib/tapioca/repo_index.rb
tapioca-0.11.2 lib/tapioca/repo_index.rb
devcycle-ruby-server-sdk-2.0.0 vendor/bundle/ruby/3.0.0/gems/tapioca-0.11.1/lib/tapioca/repo_index.rb
tapioca-0.11.1 lib/tapioca/repo_index.rb
tapioca-0.11.0 lib/tapioca/repo_index.rb
tapioca-0.10.5 lib/tapioca/repo_index.rb
tapioca-0.10.4 lib/tapioca/repo_index.rb
tapioca-0.10.3 lib/tapioca/repo_index.rb