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

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

Direct Known Subclasses

Enum, Fixed, Range

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, unit, default = nil) ⇒ Property

Returns a new instance of Property.



23
24
25
26
27
# File 'lib/deltacloud/client/helpers/property_helper.rb', line 23

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

Instance Attribute Details

#defaultObject (readonly)

Returns the value of attribute default.



21
22
23
# File 'lib/deltacloud/client/helpers/property_helper.rb', line 21

def default
  @default
end

#nameObject (readonly)

Returns the value of attribute name.



21
22
23
# File 'lib/deltacloud/client/helpers/property_helper.rb', line 21

def name
  @name
end

#unitObject (readonly)

Returns the value of attribute unit.



21
22
23
# File 'lib/deltacloud/client/helpers/property_helper.rb', line 21

def unit
  @unit
end

Class Method Details

.parse(body) ⇒ Object



33
34
35
# File 'lib/deltacloud/client/helpers/property_helper.rb', line 33

def self.parse(body)
  Property.new(body['name'], body['unit'], body['value'])
end

Instance Method Details

#kindObject



37
38
39
# File 'lib/deltacloud/client/helpers/property_helper.rb', line 37

def kind
  self.class.name.split('::').last.downcase.to_sym
end

#valueObject



29
30
31
# File 'lib/deltacloud/client/helpers/property_helper.rb', line 29

def value
  @default || 'opaque'
end