class Construi::IntermediateImage

An image that represents an intermediatae state of an image. Useful for performing operations where each opertion is performed on the result of the last.

Attributes

image[R]

Public Class Methods

new(image) click to toggle source
# File lib/construi/image.rb, line 125
def initialize(image)
  @image = image
  @first = true
end
seed(image) click to toggle source
# File lib/construi/image.rb, line 155
def self.seed(image)
  new image
end

Public Instance Methods

delete() click to toggle source
# File lib/construi/image.rb, line 151
def delete
  @image.delete unless @image.tagged?
end
map() { |image)| ... } click to toggle source
# File lib/construi/image.rb, line 134
def map
  update(yield @image)
end
reduce(iter) { |i, item| ... } click to toggle source
# File lib/construi/image.rb, line 138
def reduce(iter)
  iter.reduce(self) do |intermediate_image, item|
    intermediate_image.map { |i| yield i, item }
  end
end
run(cmd, options = {}) click to toggle source
# File lib/construi/image.rb, line 130
def run(cmd, options = {})
  map { |i| i.run cmd, options }
end
update(image) click to toggle source
# File lib/construi/image.rb, line 144
def update(image)
  delete unless @first
  @first = false
  @image = image
  self
end