Class: VagrantPlugins::Invade::InvadeModule::Hostmanager

Inherits:
InvadeModule show all
Defined in:
lib/vagrant-invade/module/hostmanager/hostmanager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from InvadeModule

#get_template_path

Constructor Details

#initialize(hostmanager_data, result: nil) ⇒ Hostmanager

Returns a new instance of Hostmanager.



10
11
12
13
# File 'lib/vagrant-invade/module/hostmanager/hostmanager.rb', line 10

def initialize(hostmanager_data, result: nil)
  @hostmanager_data = hostmanager_data
  @result = result
end

Instance Attribute Details

#hostmanager_dataObject

Returns the value of attribute hostmanager_data.



8
9
10
# File 'lib/vagrant-invade/module/hostmanager/hostmanager.rb', line 8

def hostmanager_data
  @hostmanager_data
end

#resultObject (readonly)

Returns the value of attribute result.



7
8
9
# File 'lib/vagrant-invade/module/hostmanager/hostmanager.rb', line 7

def result
  @result
end

Instance Method Details

#buildObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/vagrant-invade/module/hostmanager/hostmanager.rb', line 15

def build
  b = binding

  begin

    # Values for hostmanager part
    enabled = @hostmanager_data['enabled']
    manage_host = @hostmanager_data['manage_host']
    manage_guest = @hostmanager_data['manage_guest']
    ignore_private_ip = @hostmanager_data['ignore_private_ip']
    include_offline = @hostmanager_data['include_offline']

    eruby = Erubis::Eruby.new(File.read(self.get_template_path(__FILE__)))
    @result = eruby.result b
  rescue TypeError, SyntaxError, SystemCallError => e
    raise(e)
  end
end