Class: AethernalAgent::Docker::Volume

Inherits:
Object
  • Object
show all
Defined in:
lib/aethernal_agent/docker/volume.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, target) ⇒ Volume

Returns a new instance of Volume.



5
6
7
8
# File 'lib/aethernal_agent/docker/volume.rb', line 5

def initialize(source, target)
  self.source = source
  self.target = target
end

Instance Attribute Details

#sourceObject

Returns the value of attribute source.



4
5
6
# File 'lib/aethernal_agent/docker/volume.rb', line 4

def source
  @source
end

#targetObject

Returns the value of attribute target.



4
5
6
# File 'lib/aethernal_agent/docker/volume.rb', line 4

def target
  @target
end

Class Method Details

.create_from_options(manifest_options, opts) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/aethernal_agent/docker/volume.rb', line 10

def self.create_from_options(manifest_options, opts)
  volumes = []
  manifest_options.each do |k,v|
    if v.present?
      if v["docker"].present? && v["docker"]["volume"].present?
        volumes << Volume.new(opts[k], v["docker"]["volume"])
      end
    end
  end

  return volumes
end

Instance Method Details

#to_dockerObject



23
24
25
# File 'lib/aethernal_agent/docker/volume.rb', line 23

def to_docker
  "#{self.source}:#{self.target}"
end