Class: Vixen::Model::Host

Inherits:
Base
  • Object
show all
Defined in:
lib/vixen/model/host.rb

Instance Attribute Summary

Attributes inherited from Base

#handle

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#get_string_property, #initialize

Constructor Details

This class inherits a constructor from Vixen::Model::Base

Class Method Details

.finalize(handle) ⇒ Object



5
6
7
8
9
# File 'lib/vixen/model/host.rb', line 5

def self.finalize(handle)
  proc do
    Vixen::Bridge.disconnect(handle)
  end
end

Instance Method Details

#open_vm(path, &block) ⇒ Object



11
12
13
# File 'lib/vixen/model/host.rb', line 11

def open_vm(path, &block)
  Vixen::Model::VM.new(Vixen::Bridge.open_vm(handle, path, &block))
end

#paths_of_running_vms(&block) ⇒ Object



23
24
25
# File 'lib/vixen/model/host.rb', line 23

def paths_of_running_vms(&block)
  Vixen::Bridge.running_vms(handle, &block) || []
end

#running_vms(&block) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/vixen/model/host.rb', line 15

def running_vms(&block)
  vms = []
  paths_of_running_vms(&block).each do |path|
    vms << open_vm(path, &block)
  end
  vms
end