Class: Construi::IntermediateImage

Inherits:
Object
  • Object
show all
Defined in:
lib/construi/image.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(image) ⇒ IntermediateImage

Returns a new instance of IntermediateImage.



113
114
115
116
# File 'lib/construi/image.rb', line 113

def initialize(image)
  @image = image
  @first = true
end

Instance Attribute Details

#imageObject (readonly)

Returns the value of attribute image.



111
112
113
# File 'lib/construi/image.rb', line 111

def image
  @image
end

Class Method Details

.seed(image) ⇒ Object



143
144
145
# File 'lib/construi/image.rb', line 143

def self.seed(image)
  new image
end

Instance Method Details

#deleteObject



139
140
141
# File 'lib/construi/image.rb', line 139

def delete
  @image.delete unless @image.tagged?
end

#mapObject



122
123
124
# File 'lib/construi/image.rb', line 122

def map
  update(yield @image)
end

#reduce(iter) ⇒ Object



126
127
128
129
130
# File 'lib/construi/image.rb', line 126

def reduce(iter)
  iter.reduce(self) do |intermediate_image, item|
    intermediate_image.map { |i| yield i, item }
  end
end

#run(cmd, env = []) ⇒ Object



118
119
120
# File 'lib/construi/image.rb', line 118

def run(cmd, env = [])
  map { |i| i.run(cmd, env) }
end

#update(image) ⇒ Object



132
133
134
135
136
137
# File 'lib/construi/image.rb', line 132

def update(image)
  delete unless @first
  @first = false
  @image = image
  self
end