Class: Holodekk::Image::Instructions::Label

Inherits:
Builder::Instruction show all
Defined in:
lib/holodekk/image/instructions/label.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Builder::Instruction

instruction_tag, tag, #tag, #to_json

Instance Attribute Details

#labelsObject

Returns the value of attribute labels.



7
8
9
# File 'lib/holodekk/image/instructions/label.rb', line 7

def labels
  @labels
end

Class Method Details

.build(labels) ⇒ Object



11
12
13
# File 'lib/holodekk/image/instructions/label.rb', line 11

def self.build(labels)
  new({ labels: labels })
end

Instance Method Details

#as_json(options = {}) ⇒ Object



15
# File 'lib/holodekk/image/instructions/label.rb', line 15

def as_json(options = {}); end

#to_dockerfileObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/holodekk/image/instructions/label.rb', line 17

def to_dockerfile
  builder = Docker::Dockerfile::InstructionBuilder.new(self)
  lines = labels.each_pair.map do |key, value|
    builder.key_pair(
      Docker::Dockerfile::InstructionBuilder::QuotedString.new(key),
      Docker::Dockerfile::InstructionBuilder::QuotedString.new(value)
    )
    builder.output!
  end
  lines.join("\n")
end