Class: ConfigBuilder::Model::Network::ForwardedPort

Inherits:
Base
  • Object
show all
Defined in:
lib/config_builder/model/network/forwarded_port.rb

Overview

Vagrant forwarded port model

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#attrs=, #call, def_model_attribute, model_attributes, new_from_hash

Constructor Details

#initializeForwardedPort

Returns a new instance of ForwardedPort.



22
23
24
# File 'lib/config_builder/model/network/forwarded_port.rb', line 22

def initialize
  @defaults = {:auto_correct => false, :id => nil}
end

Instance Attribute Details

#auto_correctBoolean

Returns Whether to automatically correct port collisions.

Returns:

  • (Boolean)

    Whether to automatically correct port collisions



16
# File 'lib/config_builder/model/network/forwarded_port.rb', line 16

def_model_attribute :auto_correct

#guestFixnum

Returns The guest port.

Returns:

  • (Fixnum)

    The guest port



8
# File 'lib/config_builder/model/network/forwarded_port.rb', line 8

def_model_attribute :guest

#hostFixnum

Returns The host port.

Returns:

  • (Fixnum)

    The host port



12
# File 'lib/config_builder/model/network/forwarded_port.rb', line 12

def_model_attribute :host

#idString?

Returns An optional name used to identify this port forward.

Returns:

  • (String, nil)

    An optional name used to identify this port forward



20
# File 'lib/config_builder/model/network/forwarded_port.rb', line 20

def_model_attribute :id

Instance Method Details

#to_procObject



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/config_builder/model/network/forwarded_port.rb', line 26

def to_proc
  Proc.new do |vm_config|
    vm_config.network(
      :forwarded_port,
      :guest        => attr(:guest),
      :host         => attr(:host),
      :auto_correct => attr(:auto_correct),
      :id           => attr(:id),
    )
  end
end