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.16.8 lib/tapioca/repo_index.rb
tapioca-0.16.7 lib/tapioca/repo_index.rb
tapioca-0.16.6 lib/tapioca/repo_index.rb
tapioca-0.16.5 lib/tapioca/repo_index.rb
tapioca-0.16.4 lib/tapioca/repo_index.rb
tapioca-0.16.3 lib/tapioca/repo_index.rb
tapioca-0.16.2 lib/tapioca/repo_index.rb
tapioca-0.16.1 lib/tapioca/repo_index.rb
tapioca-0.16.0 lib/tapioca/repo_index.rb
tapioca-0.15.1 lib/tapioca/repo_index.rb
tapioca-0.15.0 lib/tapioca/repo_index.rb
tapioca-0.14.4 lib/tapioca/repo_index.rb
tapioca-0.14.3 lib/tapioca/repo_index.rb
tapioca-0.13.3 lib/tapioca/repo_index.rb
tapioca-0.13.2 lib/tapioca/repo_index.rb
tapioca-0.13.1 lib/tapioca/repo_index.rb
tapioca-0.13.0 lib/tapioca/repo_index.rb
tapioca-0.12.0 lib/tapioca/repo_index.rb
tapioca-0.11.17 lib/tapioca/repo_index.rb
tapioca-0.11.16 lib/tapioca/repo_index.rb