Class: Fog::Compute::Hyperv::Host
- Inherits:
-
Hyperv::Model
- Object
- Model
- Hyperv::Model
- Fog::Compute::Hyperv::Host
- Defined in:
- lib/fog/hyperv/models/compute/host.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Host
constructor
A new instance of Host.
Methods included from Hyperv::ModelExtends
Methods included from Hyperv::ModelIncludes
#cluster, #computer, #dirty?, #lazy_attributes, #parent, #vm
Constructor Details
#initialize(attrs = {}) ⇒ Host
Returns a new instance of Host.
18 19 20 21 22 23 |
# File 'lib/fog/hyperv/models/compute/host.rb', line 18 def initialize(attrs = {}) super @collections = {} self.class.ensure_collections! end |
Class Method Details
.ensure_collections! ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/fog/hyperv/models/compute/host.rb', line 25 def self.ensure_collections! return if @collections @collections = true Fog::Compute::Hyperv.collections.each do |coll| # Hosts don't have host collections next if coll == :hosts coll_name = coll.to_s.split('_').map(&:capitalize).join klass = Fog::Compute::Hyperv.const_get(coll_name) next if klass.requires?(:vm) define_method coll do @collections[coll] ||= service.send(coll, computer: self) end end end |