Class: VagrantPlugins::Invade::InvadeModule::Vm
- Inherits:
-
InvadeModule
- Object
- InvadeModule
- VagrantPlugins::Invade::InvadeModule::Vm
- Defined in:
- lib/vagrant-invade/module/vm/vm.rb
Instance Attribute Summary collapse
-
#machine_name ⇒ Object
Returns the value of attribute machine_name.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#vm_data ⇒ Object
Returns the value of attribute vm_data.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(machine_name, vm_data, result: nil) ⇒ Vm
constructor
A new instance of Vm.
Methods inherited from InvadeModule
Constructor Details
#initialize(machine_name, vm_data, result: nil) ⇒ Vm
Returns a new instance of Vm.
9 10 11 12 13 |
# File 'lib/vagrant-invade/module/vm/vm.rb', line 9 def initialize(machine_name, vm_data, result: nil) @machine_name = machine_name @vm_data = vm_data @result = result end |
Instance Attribute Details
#machine_name ⇒ Object
Returns the value of attribute machine_name.
7 8 9 |
# File 'lib/vagrant-invade/module/vm/vm.rb', line 7 def machine_name @machine_name end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
6 7 8 |
# File 'lib/vagrant-invade/module/vm/vm.rb', line 6 def result @result end |
#vm_data ⇒ Object
Returns the value of attribute vm_data.
7 8 9 |
# File 'lib/vagrant-invade/module/vm/vm.rb', line 7 def vm_data @vm_data end |
Instance Method Details
#build ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/vagrant-invade/module/vm/vm.rb', line 15 def build b = binding begin # Get machine name machine_name = @machine_name # Values for vm section box = @vm_data['box'] url = @vm_data['url'] hostname = @vm_data['hostname'] eruby = Erubis::Eruby.new(File.read(self.get_template_path(__FILE__))) @result = eruby.result b rescue TypeError, SyntaxError, SystemCallError => e raise(e) end end |