Class: Fog::Attributes::Hypervenumarray

Inherits:
Default
  • Object
show all
Defined in:
lib/fog/hyperv/fog_extensions/attributes/enumarray.rb

Overview

Fog attribute type for handling arrays of enums from PowerShell, where each value might be returned as a number or string depending on the context

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model, name, options) ⇒ Hypervenumarray

Returns a new instance of Hypervenumarray.



9
10
11
12
13
14
15
16
# File 'lib/fog/hyperv/fog_extensions/attributes/enumarray.rb', line 9

def initialize(model, name, options)
  @values = options.fetch(:values, [])

  raise Fog::Hyperv::Errors::ServiceError, "#{values} is not a valid array or hash" \
    unless %w[Array Hash].include?(values.class.to_s)

  super
end

Instance Attribute Details

#valuesObject (readonly)

Returns the value of attribute values.



7
8
9
# File 'lib/fog/hyperv/fog_extensions/attributes/enumarray.rb', line 7

def values
  @values
end