Sha256: 527c2c701ef2d5a1c08831a7114198c0d078e55ac2e8523e1d8e798528681dd7

Contents?: true

Size: 1.41 KB

Versions: 22

Compression:

Stored size: 1.41 KB

Contents

module VagrantPlugins
  module Parallels
    module Model
      # Represents a single forwarded port for Parallels Desktop. This has
      # various helpers and defaults for a forwarded port.
      class ForwardedPort
        # If true, the forwarded port should be auto-corrected.
        #
        # @return [Boolean]
        attr_reader :auto_correct

        # The unique ID for the forwarded port.
        #
        # @return [String]
        attr_reader :id

        # The protocol to forward.
        #
        # @return [String]
        attr_reader :protocol

        # The port on the guest to be exposed on the host.
        #
        # @return [Integer]
        attr_reader :guest_port

        # The port on the host used to access the port on the guest.
        #
        # @return [Integer]
        attr_reader :host_port

        def initialize(id, host_port, guest_port, options)
          @id         = id
          @guest_port = guest_port
          @host_port  = host_port

          options ||= {}
          @auto_correct = false
          @auto_correct = options[:auto_correct] if options.has_key?(:auto_correct)
          @protocol = options[:protocol] || 'tcp'
        end

        # This corrects the host port and changes it to the given new port.
        #
        # @param [Integer] new_port The new port
        def correct_host_port(new_port)
          @host_port = new_port
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
vagrant-parallels-2.2.2 lib/vagrant-parallels/model/forwarded_port.rb
vagrant-parallels-2.2.1 lib/vagrant-parallels/model/forwarded_port.rb
vagrant-parallels-2.2.0 lib/vagrant-parallels/model/forwarded_port.rb
vagrant-parallels-2.1.0 lib/vagrant-parallels/model/forwarded_port.rb
vagrant-parallels-2.0.1 lib/vagrant-parallels/model/forwarded_port.rb
vagrant-parallels-2.0.0 lib/vagrant-parallels/model/forwarded_port.rb
vagrant-parallels-1.7.8 lib/vagrant-parallels/model/forwarded_port.rb
vagrant-parallels-1.7.7 lib/vagrant-parallels/model/forwarded_port.rb
vagrant-parallels-1.7.6 lib/vagrant-parallels/model/forwarded_port.rb
vagrant-parallels-1.7.5 lib/vagrant-parallels/model/forwarded_port.rb
vagrant-parallels-1.7.4 lib/vagrant-parallels/model/forwarded_port.rb
vagrant-parallels-1.7.3 lib/vagrant-parallels/model/forwarded_port.rb
vagrant-parallels-1.7.2 lib/vagrant-parallels/model/forwarded_port.rb
vagrant-parallels-1.7.1 lib/vagrant-parallels/model/forwarded_port.rb
vagrant-parallels-1.7.0 lib/vagrant-parallels/model/forwarded_port.rb
vagrant-parallels-1.6.3 lib/vagrant-parallels/model/forwarded_port.rb
vagrant-parallels-1.6.2 lib/vagrant-parallels/model/forwarded_port.rb
vagrant-parallels-1.6.1 lib/vagrant-parallels/model/forwarded_port.rb
vagrant-parallels-1.6.0 lib/vagrant-parallels/model/forwarded_port.rb
vagrant-parallels-1.5.1 lib/vagrant-parallels/model/forwarded_port.rb