Class: Fog::Hyperv::VMCollection

Inherits:
ComputerCollection show all
Defined in:
lib/fog/collection.rb

Instance Attribute Summary collapse

Attributes inherited from ComputerCollection

#cluster, #computer

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ComputerCollection

requires_computer

Methods inherited from Collection

#all, #create, #get, get_method, requires, requires?

Instance Attribute Details

#vmObject

Returns the value of attribute vm.



101
102
103
# File 'lib/fog/collection.rb', line 101

def vm
  @vm
end

Class Method Details

.match_on(attr = nil) ⇒ Object



93
94
95
# File 'lib/fog/collection.rb', line 93

def self.match_on(attr = nil)
  @match_on ||= attr
end

.requires_vmObject



97
98
99
# File 'lib/fog/collection.rb', line 97

def self.requires_vm
  requires << :vm
end

Instance Method Details

#inspectObject



111
112
113
114
# File 'lib/fog/collection.rb', line 111

def inspect
  # To avoid recursing on VM
  to_s
end

#new(attributes = {}) ⇒ Object



103
104
105
106
107
108
109
# File 'lib/fog/collection.rb', line 103

def new(attributes = {})
  object = super
  # Ensure both ID and Name are populated, regardless of `match_on`
  object.vm_id ||= vm.id if vm && object.respond_to?(:vm_id)
  object.vm_name ||= vm.name if vm && object.respond_to?(:vm_name)
  object
end