Class: Baha::ContainerOptions::Volumes

Inherits:
Option
  • Object
show all
Defined in:
lib/baha/container_options/volumes.rb

Constant Summary

Constants inherited from Option

Option::KEYS

Instance Attribute Summary

Attributes inherited from Option

#config_key, #key, #value

Instance Method Summary collapse

Methods inherited from Option

#eql?, #inspect

Constructor Details

#initialize(*args) ⇒ Volumes

Returns a new instance of Volumes.



5
6
7
# File 'lib/baha/container_options/volumes.rb', line 5

def initialize(*args)
  super(:volumes,*args)
end

Instance Method Details

#apply(config) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/baha/container_options/volumes.rb', line 8

def apply(config)
  unless config.has_key?('Volumes')
    config['Volumes'] = {}
  end
  @value.each do |mount|
    config['Volumes'][mount] = {}
  end
end

#validate!Object



16
17
18
19
20
21
# File 'lib/baha/container_options/volumes.rb', line 16

def validate!
  raise ERROR("should be an array") unless @value.kind_of?(Array)
  @value.each_with_index do |item,index|
    raise ERROR("#{index}: '#{item}' should be a string") unless item.kind_of?(String)
  end
end