module DockerCompose::Generator::Service::Ports
Handles Ports
in the docker-compose file
Public Instance Methods
add_port(host, container = nil)
click to toggle source
# File lib/docker-compose/generator/service/ports.rb, line 6 def add_port(host, container = nil) host = "#{host}:#{container}" if container add_to_array('ports', "#{host}") end
drop_port(host, container)
click to toggle source
# File lib/docker-compose/generator/service/ports.rb, line 12 def drop_port(host, container) host = "#{host}:#{container}" if container drop_from_array('ports', "#{host}") end
port?(host, container = nil)
click to toggle source
# File lib/docker-compose/generator/service/ports.rb, line 18 def port?(host, container = nil) host = "#{host}:#{container}" if container ports = @attrs['ports'] || [] ports.include?("#{host}") end