Class: VagrantPlugins::Invade::InvadeModule::Network::ForwardedPort
- Inherits:
-
InvadeModule
- Object
- InvadeModule
- VagrantPlugins::Invade::InvadeModule::Network::ForwardedPort
- Defined in:
- lib/vagrant-invade/module/network/forwarded_port/forwarded_port.rb
Instance Attribute Summary collapse
-
#forwarded_port_data ⇒ Object
Returns the value of attribute forwarded_port_data.
-
#machine_name ⇒ Object
Returns the value of attribute machine_name.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(machine_name, forwarded_port_data, result: nil) ⇒ ForwardedPort
constructor
A new instance of ForwardedPort.
Methods inherited from InvadeModule
Constructor Details
#initialize(machine_name, forwarded_port_data, result: nil) ⇒ ForwardedPort
Returns a new instance of ForwardedPort.
11 12 13 14 15 |
# File 'lib/vagrant-invade/module/network/forwarded_port/forwarded_port.rb', line 11 def initialize(machine_name, forwarded_port_data, result: nil) @machine_name = machine_name @forwarded_port_data = forwarded_port_data @result = result end |
Instance Attribute Details
#forwarded_port_data ⇒ Object
Returns the value of attribute forwarded_port_data.
9 10 11 |
# File 'lib/vagrant-invade/module/network/forwarded_port/forwarded_port.rb', line 9 def forwarded_port_data @forwarded_port_data end |
#machine_name ⇒ Object
Returns the value of attribute machine_name.
9 10 11 |
# File 'lib/vagrant-invade/module/network/forwarded_port/forwarded_port.rb', line 9 def machine_name @machine_name end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
8 9 10 |
# File 'lib/vagrant-invade/module/network/forwarded_port/forwarded_port.rb', line 8 def result @result end |
Instance Method Details
#build ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/vagrant-invade/module/network/forwarded_port/forwarded_port.rb', line 17 def build b = binding begin # Get machine name machine_name = @machine_name # Values for network section ip = @forwarded_port_data['ip'] dhcp = @forwarded_port_data['dhcp'] guest = @forwarded_port_data['guest'] guest_ip = @forwarded_port_data['guest_ip'] host = @forwarded_port_data['host'] host_ip = @forwarded_port_data['host_ip'] protocol = @forwarded_port_data['protocol'] auto_correct = @forwarded_port_data['auto_correct'] eruby = Erubis::Eruby.new(File.read(self.get_template_path(__FILE__))) @result = eruby.result b rescue TypeError, SyntaxError, SystemCallError => e raise(e) end end |