Class: Fog::Hyperv::Model

Inherits:
Model
  • Object
show all
Extended by:
ModelExtends
Includes:
ModelIncludes
Defined in:
lib/fog/hyperv/model.rb

Overview

A slightly specialized Fog::Model which includes shared Hyper-V functionality

Instance Method Summary collapse

Methods included from ModelExtends

collection

Methods included from ModelIncludes

#cluster, #computer, #dirty, #dirty?, #vm

Constructor Details

#initialize(attributes = {}) ⇒ Model

Returns a new instance of Model.



122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/fog/hyperv/model.rb', line 122

def initialize(attributes = {})
  @vm = attributes.delete :vm
  self.attributes[:vm] = @vm if self.class.attributes.include? :vm
  @computer = attributes.delete :computer
  self.attributes[:computer] = @computer if self.class.attributes.include? :computer
  @cluster = attributes.delete :cluster
  self.attributes[:cluster] = @cluster if self.class.attributes.include? :cluster

  super

  @old = dup if persisted?
end

Instance Method Details

#merge_attributes(attributes = {}) ⇒ Object



135
136
137
138
139
140
# File 'lib/fog/hyperv/model.rb', line 135

def merge_attributes(attributes = {})
  super

  @old = dup
  self
end