Class: OCCI::Core::Resource

Inherits:
Entity
  • Object
show all
Defined in:
lib/occi/core/resource.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Entity

check, #check, #id, #id=, #initialize, #location, #title, #title=, #type_identifier

Constructor Details

This class inherits a constructor from OCCI::Core::Entity

Class Method Details

.registerObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/occi/core/resource.rb', line 31

def self.register
  data = Hashie::Mash.new
  data[:related] = %w{http://schemas.ogf.org/occi/core#entity}
  data[:term] = "resource"
  data[:scheme] = "http://schemas.ogf.org/occi/core#"
  data[:title] = "Resource"

  data.attributes!.occi!.core!.summary!.type = "string"
  data.attributes!.occi!.core!.summary!.pattern = ".*"
  data.attributes!.occi!.core!.summary!.required = false
  data.attributes!.occi!.core!.summary!.mutable = true

  kind = OCCI::Core::Kind.new(data)
  OCCI::Registry.register(kind)
end

Instance Method Details

#convert_value(val, duping = false) ⇒ Object

:nodoc:



56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/occi/core/resource.rb', line 56

def convert_value(val, duping=false) #:nodoc:
  case val
    when self.class
      val.dup
    when ::Hash
      val = val.dup if duping
      self.class.subkey_class.new.merge(val) unless val.kind_of?(Hashie::Mash)
      val
    when Array
      val.collect { |e| convert_value(e) }
    else
      val
  end
end

#summaryObject



47
48
49
# File 'lib/occi/core/resource.rb', line 47

def summary
  return self[:summary]
end

#summary=(summary) ⇒ Object



51
52
53
54
# File 'lib/occi/core/resource.rb', line 51

def summary=(summary)
  self[:summary] = summary
  self.attributes!.occi!.core!.summary = summary
end