Class: ContainerRegistry::Blob
- Inherits:
-
Object
- Object
- ContainerRegistry::Blob
- Defined in:
- lib/container_registry/blob.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
Instance Method Summary collapse
- #data ⇒ Object
- #delete ⇒ Object
- #digest ⇒ Object
-
#initialize(repository, config) ⇒ Blob
constructor
A new instance of Blob.
- #path ⇒ Object
- #revision ⇒ Object
- #short_revision ⇒ Object
- #size ⇒ Object
- #type ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(repository, config) ⇒ Blob
Returns a new instance of Blob.
9 10 11 12 |
# File 'lib/container_registry/blob.rb', line 9 def initialize(repository, config) @repository = repository @config = config || {} end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/container_registry/blob.rb', line 5 def config @config end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
5 6 7 |
# File 'lib/container_registry/blob.rb', line 5 def repository @repository end |
Instance Method Details
#data ⇒ Object
46 47 48 |
# File 'lib/container_registry/blob.rb', line 46 def data @data ||= client.blob(repository.path, digest, type) end |
#delete ⇒ Object
42 43 44 |
# File 'lib/container_registry/blob.rb', line 42 def delete client.delete_blob(repository.path, digest) end |
#digest ⇒ Object
22 23 24 |
# File 'lib/container_registry/blob.rb', line 22 def digest config['digest'] || config['blobSum'] end |
#path ⇒ Object
18 19 20 |
# File 'lib/container_registry/blob.rb', line 18 def path "#{repository.path}@#{digest}" end |
#revision ⇒ Object
34 35 36 |
# File 'lib/container_registry/blob.rb', line 34 def revision digest.split(':')[1] end |
#short_revision ⇒ Object
38 39 40 |
# File 'lib/container_registry/blob.rb', line 38 def short_revision revision[0..8] end |
#size ⇒ Object
30 31 32 |
# File 'lib/container_registry/blob.rb', line 30 def size config['size'] end |
#type ⇒ Object
26 27 28 |
# File 'lib/container_registry/blob.rb', line 26 def type config['mediaType'] end |
#valid? ⇒ Boolean
14 15 16 |
# File 'lib/container_registry/blob.rb', line 14 def valid? digest.present? end |