Class: AethernalAgent::Docker::PortBinding
- Inherits:
-
Object
- Object
- AethernalAgent::Docker::PortBinding
- Defined in:
- lib/aethernal_agent/docker/port_binding.rb
Instance Attribute Summary collapse
-
#source ⇒ Object
Returns the value of attribute source.
-
#target ⇒ Object
Returns the value of attribute target.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(source, target) ⇒ PortBinding
constructor
A new instance of PortBinding.
- #to_docker ⇒ Object
Constructor Details
#initialize(source, target) ⇒ PortBinding
Returns a new instance of PortBinding.
6 7 8 9 |
# File 'lib/aethernal_agent/docker/port_binding.rb', line 6 def initialize(source, target) self.source = source self.target = target end |
Instance Attribute Details
#source ⇒ Object
Returns the value of attribute source.
5 6 7 |
# File 'lib/aethernal_agent/docker/port_binding.rb', line 5 def source @source end |
#target ⇒ Object
Returns the value of attribute target.
5 6 7 |
# File 'lib/aethernal_agent/docker/port_binding.rb', line 5 def target @target end |
Class Method Details
.create_from_options(manifest_options, opts) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/aethernal_agent/docker/port_binding.rb', line 11 def self.(, opts) bindings = {} .each do |k,v| if v.present? if v["docker"].present? && v["docker"]["source"].present? if v["docker"]["source"].to_s.include?("$port") v["docker"]["source"].gsub!("$port", opts[k].to_s) end bindings.merge!(PortBinding.new(v["docker"]["source"], opts[k]).to_docker) end end end return bindings end |
Instance Method Details
#to_docker ⇒ Object
27 28 29 |
# File 'lib/aethernal_agent/docker/port_binding.rb', line 27 def to_docker { self.source => [{ "HostPort" => self.target.to_s}] } end |