Class: Fog::Hyperv::VMCollection
Instance Attribute Summary collapse
#computer
Class Method Summary
collapse
Instance Method Summary
collapse
requires_computer
Methods inherited from Collection
#all, #get, get_method, #new, requires?
Instance Attribute Details
#vm ⇒ Object
Returns the value of attribute vm.
78
79
80
|
# File 'lib/fog/collection.rb', line 78
def vm
@vm
end
|
Class Method Details
.match_on(attr = nil) ⇒ Object
70
71
72
|
# File 'lib/fog/collection.rb', line 70
def self.match_on(attr = nil)
@match_on ||= attr
end
|
.requires_vm ⇒ Object
74
75
76
|
# File 'lib/fog/collection.rb', line 74
def self.requires_vm
requires? << :vm
end
|
Instance Method Details
#create(attributes = {}) ⇒ Object
89
90
91
92
93
94
95
96
|
# File 'lib/fog/collection.rb', line 89
def create(attributes = {})
object = new(attributes)
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.save
object
end
|
#inspect ⇒ Object
98
99
100
101
|
# File 'lib/fog/collection.rb', line 98
def inspect
to_s
end
|
#search_attributes ⇒ Object
80
81
82
83
84
85
86
87
|
# File 'lib/fog/collection.rb', line 80
def search_attributes
attrs = super
if vm
attrs[:computer_name] ||= vm.computer_name
attrs[match] = vm.send(match)
end
attrs
end
|