Module: Fog::Hyperv::ModelIncludes

Included in:
Compute::Hyperv::Server, Model
Defined in:
lib/fog/model.rb

Instance Method Summary collapse

Instance Method Details

#dirty?Boolean

Returns:

  • (Boolean)


15
16
17
18
19
# File 'lib/fog/model.rb', line 15

def dirty?
  attributes.reject do |k, v|
    !self.class.attributes.include?(k) || lazy_attributes.include?(k) || (old ? old.attributes[k] == v : false)
  end.any?
end

#lazy_attributesObject



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

def lazy_attributes
  self.class.respond_to?(:lazy_attributes) ? self.class.lazy_attributes : []
end

#parentObject



21
22
23
24
25
26
27
28
29
30
# File 'lib/fog/model.rb', line 21

def parent
  return nil unless collection
  return collection.vm if collection.attributes.include? :vm
  return collection.computer if collection.attributes.include? :computer
  @parent ||= begin
    r = service.servers.get vm_name if attributes.include? :vm_name
    r = service.hosts.get computer_name if attributes.include? :computer_name
    r
  end
end