Class: Tapioca::RepoIndex
- Inherits:
-
Object
- Object
- Tapioca::RepoIndex
show all
- Extended by:
- T::Generic, T::Sig
- Defined in:
- lib/tapioca/repo_index.rb
Class Method Summary
collapse
Instance Method Summary
collapse
#[], #type_member, #type_template
Constructor Details
Returns a new instance of RepoIndex.
22
23
24
|
# File 'lib/tapioca/repo_index.rb', line 22
def initialize
@entries = T.let(Set.new, T::Set[String])
end
|
Class Method Details
.from_hash(hash) ⇒ Object
15
16
17
18
19
|
# File 'lib/tapioca/repo_index.rb', line 15
def self.from_hash(hash)
hash.each_with_object(RepoIndex.new) do |(name, _), index|
index << name
end
end
|
.from_json(json) ⇒ Object
10
11
12
|
# File 'lib/tapioca/repo_index.rb', line 10
def self.from_json(json)
RepoIndex.from_hash(JSON.parse(json))
end
|
Instance Method Details
#<<(gem_name) ⇒ Object
27
28
29
|
# File 'lib/tapioca/repo_index.rb', line 27
def <<(gem_name)
@entries.add(gem_name)
end
|
#gems ⇒ Object
32
33
34
|
# File 'lib/tapioca/repo_index.rb', line 32
def gems
@entries.sort
end
|
#has_gem?(gem_name) ⇒ Boolean
37
38
39
|
# File 'lib/tapioca/repo_index.rb', line 37
def has_gem?(gem_name)
@entries.include?(gem_name)
end
|