Class: ConfigBuilder::Model::Network::ForwardedPort
- Defined in:
- lib/config_builder/model/network/forwarded_port.rb
Overview
Vagrant forwarded port model
Instance Attribute Summary collapse
-
#auto_correct ⇒ Boolean
Whether to automatically correct port collisions.
-
#guest ⇒ Fixnum
The port on the guest that you want to be exposed on the host.
-
#guest_ip ⇒ String
The guest IP to bind the forwarded port to.
-
#host ⇒ Fixnum
The port on the host that you want to use to access the port on the guest.
-
#host_ip ⇒ String
The IP on the host you want to bind the forwarded port to.
-
#id ⇒ String?
An optional name used to identify this port forward.
-
#protocol ⇒ String
Either
udp
ortcp
.
Instance Method Summary collapse
- #forwarded_port_opts ⇒ Object
-
#initialize ⇒ ForwardedPort
constructor
A new instance of ForwardedPort.
- #to_proc ⇒ Object
Methods inherited from Base
#attr, #attrs=, #call, #configure!, def_model_attribute, def_model_delegator, def_model_id, def_model_option, #eval_models, #instance_id, #instance_options, model_attributes, model_delegators, #model_delegators, model_options, new_from_hash, #with_attr
Constructor Details
#initialize ⇒ ForwardedPort
Returns a new instance of ForwardedPort.
37 38 39 |
# File 'lib/config_builder/model/network/forwarded_port.rb', line 37 def initialize @defaults = {:auto_correct => false, :id => nil} end |
Instance Attribute Details
#auto_correct ⇒ Boolean
Returns Whether to automatically correct port collisions.
35 |
# File 'lib/config_builder/model/network/forwarded_port.rb', line 35 def_model_attribute :auto_correct |
#guest ⇒ Fixnum
Returns The port on the guest that you want to be exposed on the host.
13 |
# File 'lib/config_builder/model/network/forwarded_port.rb', line 13 def_model_attribute :guest |
#guest_ip ⇒ String
Returns The guest IP to bind the forwarded port to.
17 |
# File 'lib/config_builder/model/network/forwarded_port.rb', line 17 def_model_attribute :guest_ip |
#host ⇒ Fixnum
Returns The port on the host that you want to use to access the port on the guest.
22 |
# File 'lib/config_builder/model/network/forwarded_port.rb', line 22 def_model_attribute :host |
#host_ip ⇒ String
Returns The IP on the host you want to bind the forwarded port to.
26 |
# File 'lib/config_builder/model/network/forwarded_port.rb', line 26 def_model_attribute :host_ip |
#id ⇒ String?
Returns An optional name used to identify this port forward.
8 |
# File 'lib/config_builder/model/network/forwarded_port.rb', line 8 def_model_attribute :id |
#protocol ⇒ String
Returns Either udp
or tcp
. This specifies the protocol that
will be allowed through the forwarded port. By default this is "tcp".
31 |
# File 'lib/config_builder/model/network/forwarded_port.rb', line 31 def_model_attribute :protocol |
Instance Method Details
#forwarded_port_opts ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/config_builder/model/network/forwarded_port.rb', line 47 def forwarded_port_opts h = {} with_attr(:id) { |val| h[:id] = val } with_attr(:guest) { |val| h[:guest] = val } with_attr(:guest_ip) { |val| h[:guest_ip] = val } with_attr(:host) { |val| h[:host] = val } with_attr(:host_ip) { |val| h[:host_ip] = val } with_attr(:protocol) { |val| h[:protocol] = val } with_attr(:auto_correct) { |val| h[:auto_correct] = val } h end |
#to_proc ⇒ Object
41 42 43 44 45 |
# File 'lib/config_builder/model/network/forwarded_port.rb', line 41 def to_proc Proc.new do |vm_config| vm_config.network(:forwarded_port, forwarded_port_opts) end end |