Class: DockerDistribution::DigestSet

Inherits:
Object
  • Object
show all
Defined in:
lib/docker_distribution/digest_set.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(digest_strings) ⇒ DigestSet

Returns a new instance of DigestSet.



9
10
11
# File 'lib/docker_distribution/digest_set.rb', line 9

def initialize(digest_strings)
  @entries = digest_strings.map { |digest_string| Digest.new(digest_string) }
end

Instance Attribute Details

#entriesObject



13
14
15
# File 'lib/docker_distribution/digest_set.rb', line 13

def entries
  @entries ||= []
end

Instance Method Details

#add(digest_string) ⇒ Object



17
18
19
# File 'lib/docker_distribution/digest_set.rb', line 17

def add(digest_string)
  @entries << Digest.new(digest_string)
end

#lookup!(digest_string) ⇒ Object

Raises:



21
22
23
24
25
26
27
28
# File 'lib/docker_distribution/digest_set.rb', line 21

def lookup!(digest_string)
  raise DigestNotFound if entries.length.zero?

  search_func, encoded, alg = parse!(digest_string)

  entry = search(search_func, encoded, alg)
  entry.digest
end