Class: OCCI::Core::AttributeProperties

Inherits:
Hashie::Mash
  • Object
show all
Defined in:
lib/occi/core/attribute_properties.rb

Instance Method Summary collapse

Constructor Details

#initialize(attributes = nil, default = nil) ⇒ AttributeProperties

Returns a new instance of AttributeProperties



28
29
30
31
32
33
34
35
36
# File 'lib/occi/core/attribute_properties.rb', line 28

def initialize(attributes = nil, default = nil)
  if attributes.type || attributes.required || attributes.mutable || attributes.pattern || attributes.minimum || attributes.maximum || attributes.description
    attributes.type ||= "string"
    attributes.required ||= false
    attributes.mutable ||= false
    attributes.pattern ||= ".*"
  end unless attributes.nil?
  super(attributes, default)
end

Instance Method Details

#combineObject



38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/occi/core/attribute_properties.rb', line 38

def combine
  array = []
  self.each_key do |key|
    puts key
    puts self[key]
    if self[key].include? 'type'
      array << key + "{}"
    else
      self[key].combine.each { |attr| array << key + '.' + attr }
    end
  end
  return array
end