Sha256: fc0710df25b79930dc6e5eba8963f830039d6a922b40b5db91475ef4fe9dbbab
Contents?: true
Size: 877 Bytes
Versions: 5
Compression:
Stored size: 877 Bytes
Contents
module Kuby module Docker class LayerStack include Enumerable attr_reader :stack, :layers def initialize @stack = [] @layers = {} end def each return to_enum(__method__) unless block_given? @stack.each { |name| yield layers[name] } end def use(name, layer) stack << name layers[name] = layer end def insert(name, layer, options = {}) existing_name = options[:before] || options[:after] idx = stack.index(existing_name) unless idx raise ArgumentError, "Could not find existing layer '#{existing_name}'" end idx += 1 if options[:after] stack.insert(idx, name) layers[name] = layer end def delete(name) stack.delete(name) layers.delete(name) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems