Class: Deltacloud::Client::Helpers::Property::Enum

Inherits:
Property
  • Object
show all
Includes:
Enumerable
Defined in:
lib/deltacloud/client/helpers/property_helper.rb

Instance Attribute Summary collapse

Attributes inherited from Property

#default, #name, #unit

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Property

#kind

Constructor Details

#initialize(name, unit, values, default = nil) ⇒ Enum

Returns a new instance of Enum.



67
68
69
70
# File 'lib/deltacloud/client/helpers/property_helper.rb', line 67

def initialize(name, unit, values, default=nil)
  @values = values
  super(name, unit, default)
end

Instance Attribute Details

#valuesObject (readonly)

Returns the value of attribute values.



65
66
67
# File 'lib/deltacloud/client/helpers/property_helper.rb', line 65

def values
  @values
end

Class Method Details

.parse(body) ⇒ Object



80
81
82
83
# File 'lib/deltacloud/client/helpers/property_helper.rb', line 80

def self.parse(body)
  base = super
  new(base.name, base.unit, body.xpath('enum/entry').map { |e| e['value'] }, base.default)
end

Instance Method Details

#eachObject



76
77
78
# File 'lib/deltacloud/client/helpers/property_helper.rb', line 76

def each
  value.each
end

#valueObject



72
73
74
# File 'lib/deltacloud/client/helpers/property_helper.rb', line 72

def value
  @values
end