Module: VagrantPlugins::Utm::Util::CompileForwardedPorts
- Includes:
- Vagrant::Util::ScopedHashOverride
- Included in:
- Action::ForwardPorts
- Defined in:
- lib/vagrant_utm/util/compile_forwarded_ports.rb
Overview
This module contains the code to compile the forwarded ports from config.
Instance Method Summary collapse
-
#compile_forwarded_ports(config) ⇒ Object
This method compiles the forwarded ports into ForwardedPort models.
Instance Method Details
#compile_forwarded_ports(config) ⇒ Object
This method compiles the forwarded ports into ForwardedPort models.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/vagrant_utm/util/compile_forwarded_ports.rb', line 17 def compile_forwarded_ports(config) # rubocop:disable Metrics/AbcSize mappings = {} config.vm.networks.each do |type, | next unless type == :forwarded_port guest_port = [:guest] host_port = [:host] host_ip = [:host_ip] protocol = [:protocol] || "tcp" = scoped_hash_override(, :utm) id = [:id] # If the forwarded port was marked as disabled, ignore. next if [:disabled] key = "#{host_ip}#{protocol}#{host_port}" mappings[key] = Model::ForwardedPort.new(id, host_port, guest_port, ) end mappings.values end |