Module: Baha::ContainerOptions

Defined in:
lib/baha/container_options.rb,
lib/baha/container_options/cmd.rb,
lib/baha/container_options/env.rb,
lib/baha/container_options/option.rb,
lib/baha/container_options/volumes.rb,
lib/baha/container_options/entrypoint.rb,
lib/baha/container_options/exposed_ports.rb,
lib/baha/container_options/invalid_option_error.rb

Defined Under Namespace

Classes: Cmd, Entrypoint, Env, ExposedPorts, InvalidOptionError, Option, Volumes

Class Method Summary collapse

Class Method Details

.parse_option(key, value) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/baha/container_options.rb', line 18

def self.parse_option(key,value)
  k = key.to_sym.downcase
  option = case k
  when :volumes
    Volumes.new(value)
  when :env
    Env.new(value)
  when :cmd 
    Cmd.new(value)
  when :entrypoint
    Entrypoint.new(value)
  when :exposedports
    ExposedPorts.new(value)
  else
    Option.new(key,value)
  end
  option.validate!
  option
end

.parse_options(options) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/baha/container_options.rb', line 10

def self.parse_options(options)
  if options
    Hash[options.map { |k,v| opt = self.parse_option(k,v)
      [opt.key,opt] }]
  else
    {}
  end
end