Class: Kuby::Docker::LocalTags
- Inherits:
-
Object
- Object
- Kuby::Docker::LocalTags
- Defined in:
- lib/kuby/docker/local_tags.rb
Instance Attribute Summary collapse
-
#cli ⇒ Object
readonly
Returns the value of attribute cli.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
Instance Method Summary collapse
-
#initialize(cli, metadata) ⇒ LocalTags
constructor
A new instance of LocalTags.
- #latest_tags ⇒ Object
- #tags ⇒ Object
- #timestamp_tags ⇒ Object
Constructor Details
#initialize(cli, metadata) ⇒ LocalTags
Returns a new instance of LocalTags.
6 7 8 9 |
# File 'lib/kuby/docker/local_tags.rb', line 6 def initialize(cli, ) @cli = cli @metadata = end |
Instance Attribute Details
#cli ⇒ Object (readonly)
Returns the value of attribute cli.
4 5 6 |
# File 'lib/kuby/docker/local_tags.rb', line 4 def cli @cli end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
4 5 6 |
# File 'lib/kuby/docker/local_tags.rb', line 4 def @metadata end |
Instance Method Details
#latest_tags ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/kuby/docker/local_tags.rb', line 16 def # find "latest" tag images = cli.images(.image_url) latest = images.find { |image| image[:tag] == Tags::LATEST } unless latest raise MissingTagError.new(Tags::LATEST) end # find all tags that point to the same image as 'latest' images.each_with_object([]) do |image_data, | if image_data[:id] == latest[:id] << image_data[:tag] end end end |
#tags ⇒ Object
11 12 13 14 |
# File 'lib/kuby/docker/local_tags.rb', line 11 def images = cli.images(.image_url) images.map { |image| image[:tag] } end |
#timestamp_tags ⇒ Object
33 34 35 |
# File 'lib/kuby/docker/local_tags.rb', line 33 def .map { |t| TimestampTag.try_parse(t) }.compact end |