Class: Fog::Attributes::Hypervenum

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

Overview

Fog attribute type for handling enums from PowelShell, where the value might be a number or string depending on the context

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model, name, options) ⇒ Hypervenum

Returns a new instance of Hypervenum.



9
10
11
12
13
14
15
16
# File 'lib/fog/hyperv/fog_extensions/attributes/enum.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/enum.rb', line 7

def values
  @values
end