Class: VagrantPlugins::Parallels::Model::ForwardedPort
- Inherits:
-
Object
- Object
- VagrantPlugins::Parallels::Model::ForwardedPort
- Defined in:
- lib/vagrant-parallels/model/forwarded_port.rb
Overview
Represents a single forwarded port for Parallels Desktop. This has various helpers and defaults for a forwarded port.
Instance Attribute Summary collapse
-
#auto_correct ⇒ Boolean
readonly
If true, the forwarded port should be auto-corrected.
-
#guest_ip ⇒ String
readonly
The ip of the guest to be used for the port.
-
#guest_port ⇒ Integer
readonly
The port on the guest to be exposed on the host.
-
#host_ip ⇒ String
readonly
The ip of the host used to access the port.
-
#host_port ⇒ Integer
readonly
The port on the host used to access the port on the guest.
-
#id ⇒ String
readonly
The unique ID for the forwarded port.
-
#protocol ⇒ String
readonly
The protocol to forward.
Instance Method Summary collapse
-
#correct_host_port(new_port) ⇒ Object
This corrects the host port and changes it to the given new port.
-
#initialize(id, host_port, guest_port, host_ip, guest_ip, **options) ⇒ ForwardedPort
constructor
A new instance of ForwardedPort.
Constructor Details
#initialize(id, host_port, guest_port, host_ip, guest_ip, **options) ⇒ ForwardedPort
Returns a new instance of ForwardedPort.
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/vagrant-parallels/model/forwarded_port.rb', line 42 def initialize(id, host_port, guest_port, host_ip, guest_ip, **) @id = id @guest_port = guest_port @guest_ip = guest_ip @host_port = host_port @host_ip = host_ip ||= {} @auto_correct = false @auto_correct = [:auto_correct] if .key?(:auto_correct) @protocol = [:protocol] || 'tcp' end |
Instance Attribute Details
#auto_correct ⇒ Boolean (readonly)
If true, the forwarded port should be auto-corrected.
10 11 12 |
# File 'lib/vagrant-parallels/model/forwarded_port.rb', line 10 def auto_correct @auto_correct end |
#guest_ip ⇒ String (readonly)
The ip of the guest to be used for the port.
35 36 37 |
# File 'lib/vagrant-parallels/model/forwarded_port.rb', line 35 def guest_ip @guest_ip end |
#guest_port ⇒ Integer (readonly)
The port on the guest to be exposed on the host.
25 26 27 |
# File 'lib/vagrant-parallels/model/forwarded_port.rb', line 25 def guest_port @guest_port end |
#host_ip ⇒ String (readonly)
The ip of the host used to access the port.
40 41 42 |
# File 'lib/vagrant-parallels/model/forwarded_port.rb', line 40 def host_ip @host_ip end |
#host_port ⇒ Integer (readonly)
The port on the host used to access the port on the guest.
30 31 32 |
# File 'lib/vagrant-parallels/model/forwarded_port.rb', line 30 def host_port @host_port end |
#id ⇒ String (readonly)
The unique ID for the forwarded port.
15 16 17 |
# File 'lib/vagrant-parallels/model/forwarded_port.rb', line 15 def id @id end |
#protocol ⇒ String (readonly)
The protocol to forward.
20 21 22 |
# File 'lib/vagrant-parallels/model/forwarded_port.rb', line 20 def protocol @protocol end |
Instance Method Details
#correct_host_port(new_port) ⇒ Object
This corrects the host port and changes it to the given new port.
58 59 60 |
# File 'lib/vagrant-parallels/model/forwarded_port.rb', line 58 def correct_host_port(new_port) @host_port = new_port end |