Class: OCCI::Core::Category
- Inherits:
-
Hashie::Mash
- Object
- Hashie::Mash
- OCCI::Core::Category
- Defined in:
- lib/occi/core/category.rb
Instance Method Summary (collapse)
-
- (Object) convert_value(val, duping = false)
:nodoc:.
-
- (Category) initialize(category = nil, default = nil)
constructor
A new instance of Category.
- - (Boolean) related_to?(category_id)
- - (Object) type_identifier
Constructor Details
- (Category) initialize(category = nil, default = nil)
A new instance of Category
29 30 31 32 |
# File 'lib/occi/core/category.rb', line 29 def initialize(category=nil, default = nil) category.attributes = OCCI::Core::AttributeProperties.new(category.attributes) if category super(category, default) end |
Instance Method Details
- (Object) convert_value(val, duping = false)
:nodoc:
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/occi/core/category.rb', line 34 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 |
- (Boolean) related_to?(category_id)
53 54 55 56 57 58 |
# File 'lib/occi/core/category.rb', line 53 def (category_id) self..each do |category| return true if category.type_identifier == category_id || category.(category_id) end if self. false end |
- (Object) type_identifier
49 50 51 |
# File 'lib/occi/core/category.rb', line 49 def type_identifier regular_reader("scheme") + regular_reader("term") end |