Sha256: 895be81482b441a6dc1d2eabb791cc904dd9834f74a9e4d2f2621c1c1cbe157f

Contents?: true

Size: 1.01 KB

Versions: 6

Compression:

Stored size: 1.01 KB

Contents

require 'vagrant/util/scoped_hash_override'

module VagrantPlugins
  module Parallels
    module Util
      module CompileForwardedPorts
        include Vagrant::Util::ScopedHashOverride

        # This method compiles the forwarded ports into {ForwardedPort}
        # models.
        def compile_forwarded_ports(config)
          mappings = {}

          config.vm.networks.each do |type, options|
            if type == :forwarded_port
              guest_port = options[:guest]
              host_port  = options[:host]
              protocol   = options[:protocol] || "tcp"
              options    = scoped_hash_override(options, :parallels)
              id         = options[:id]

              # If the forwarded port was marked as disabled, ignore.
              next if options[:disabled]

              mappings[host_port.to_s + protocol.to_s] =
                Model::ForwardedPort.new(id, host_port, guest_port, options)
            end
          end

          mappings.values
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vagrant-parallels-1.3.0 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-1.2.2 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-1.2.1 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-1.2.0 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-1.2.0.rc2 lib/vagrant-parallels/util/compile_forwarded_ports.rb
vagrant-parallels-1.2.0.rc1 lib/vagrant-parallels/util/compile_forwarded_ports.rb