class OSwitch::Image

Public Class Methods

all() click to toggle source
# File lib/oswitch/image.rb, line 12
def all
  `docker images`.split("\n").drop(1).
    map{|l| Image.new(*l.split(/\s{2,}/))}
end
each(&block) click to toggle source
# File lib/oswitch/image.rb, line 17
def each(&block)
  all.each(&block)
end
exists?(imgname) click to toggle source
# File lib/oswitch/image.rb, line 28
def exists?(imgname)
  !!get(imgname)
end
get(imgname) click to toggle source
# File lib/oswitch/image.rb, line 21
def get(imgname)
  repository, tag = imgname.split(':')
  return if not repository or repository.empty?
  tag = 'latest' if not tag or tag.empty?
  find {|img| img.repository == repository and img.tag == tag}
end