lib/qb/docker/image/name.rb in qb-0.4.2 vs lib/qb/docker/image/name.rb in qb-0.4.3
- old
+ new
@@ -167,20 +167,25 @@
def self.exists? name
QB::Docker::CLI.image_named? name
end # .exists?
+ def self.all
+ QB::Docker::CLI.image_names load: true, only_named: true
+ end
+
+
# @see QB::Docker::CLI.image_names
#
- +QB::Util::Decorators::NoPropsInKwds
- def self.list *args, **opts
- QB::Docker::CLI.image_names *args, **opts
+ def self.list **attrs
+ return all if attrs.empty?
+
+ type = t.attrs attrs
+ all.select { |name| type === name }
end # .list
- singleton_class.send :alias_method, :all, :list
-
# Props
# ======================================================================
# @!attribute [r] source
# Source string this name was loaded from, if any.
@@ -206,19 +211,21 @@
# The repository name, if any.
#
# @return [String?]
# String is non-empty.
prop :repository,
+ aliases: [ :repo ],
type: t.non_empty_str?
# @!attribute [r] registry_server
# Registry server, if any.
#
# @return [String?]
# String is non-empty.
prop :registry_server,
+ aliases: [ :reg ],
type: t.non_empty_str?
# @!attribute [r] port
# Registry server port, if any.
@@ -236,12 +243,11 @@
prop :string,
type: t.non_empty_str,
source: :to_s
- invariant t.attrs( registry_server: t.nil, port: t.nil ) |
- t.attrs( registry_server: ~t.nil, port: ~t.nil )
+ invariant ~t.attrs( registry_server: t.nil, port: ~t.nil )
# Instance Methods
# ======================================================================
@@ -270,10 +276,16 @@
!!tag.try( :dirty? )
end # #dirty?
def host
- "#{ registry_server }:#{ port }" if registry_server && port
+ return unless registry_server
+
+ if port
+ "#{ registry_server }:#{ port }"
+ else
+ registry_server
+ end
end
def formatted
[