Class: Kuby::Docker::Tags
- Inherits:
-
Object
- Object
- Kuby::Docker::Tags
- Extended by:
- T::Sig
- Defined in:
- lib/kuby/docker/tags.rb
Constant Summary collapse
- LATEST =
Metadata::LATEST_TAG
Instance Attribute Summary collapse
-
#cli ⇒ Object
readonly
Returns the value of attribute cli.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#remote_client ⇒ Object
readonly
Returns the value of attribute remote_client.
Instance Method Summary collapse
- #all ⇒ Object
-
#initialize(cli, remote_client, metadata) ⇒ Tags
constructor
A new instance of Tags.
- #latest_tags ⇒ Object
- #latest_timestamp_tag ⇒ Object
- #local ⇒ Object
- #previous_timestamp_tag(current_tag) ⇒ Object
- #remote ⇒ Object
- #tags ⇒ Object
- #timestamp_tags ⇒ Object
Constructor Details
#initialize(cli, remote_client, metadata) ⇒ Tags
Returns a new instance of Tags.
27 28 29 30 31 32 33 34 35 |
# File 'lib/kuby/docker/tags.rb', line 27 def initialize(cli, remote_client, ) @cli = cli @remote_client = remote_client @metadata = @local = T.let(@local, T.nilable(LocalTags)) @remote = T.let(@remote, T.nilable(RemoteTags)) @latest_timestamp_tag = T.let(@latest_timestamp_tag, T.nilable(TimestampTag)) end |
Instance Attribute Details
#cli ⇒ Object (readonly)
Returns the value of attribute cli.
11 12 13 |
# File 'lib/kuby/docker/tags.rb', line 11 def cli @cli end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
17 18 19 |
# File 'lib/kuby/docker/tags.rb', line 17 def @metadata end |
#remote_client ⇒ Object (readonly)
Returns the value of attribute remote_client.
14 15 16 |
# File 'lib/kuby/docker/tags.rb', line 14 def remote_client @remote_client end |
Instance Method Details
#all ⇒ Object
77 78 79 |
# File 'lib/kuby/docker/tags.rb', line 77 def all self end |
#latest_tags ⇒ Object
43 44 45 |
# File 'lib/kuby/docker/tags.rb', line 43 def (local. + remote.).uniq end |
#latest_timestamp_tag ⇒ Object
72 73 74 |
# File 'lib/kuby/docker/tags.rb', line 72 def @latest_timestamp_tag ||= .sort.last end |
#local ⇒ Object
82 83 84 |
# File 'lib/kuby/docker/tags.rb', line 82 def local @local ||= LocalTags.new(cli, ) end |
#previous_timestamp_tag(current_tag) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/kuby/docker/tags.rb', line 50 def (current_tag) current_tag = TimestampTag.try_parse(current_tag) return nil unless current_tag = .sort idx = .index do |tag| tag.time == current_tag.time end idx ||= 0 return nil unless idx > 0 [idx - 1] end |
#remote ⇒ Object
87 88 89 |
# File 'lib/kuby/docker/tags.rb', line 87 def remote @remote ||= RemoteTags.new(remote_client, ) end |
#tags ⇒ Object
38 39 40 |
# File 'lib/kuby/docker/tags.rb', line 38 def (local. + remote.).uniq end |
#timestamp_tags ⇒ Object
67 68 69 |
# File 'lib/kuby/docker/tags.rb', line 67 def (local. + remote.).uniq end |