Permalink
Browse files

Collection

- added append operator << to collection class
  • Loading branch information...
ffeldhaus
ffeldhaus committed May 6, 2013
1 parent cd52da5 commit d03b1da378852bafeed844ec019e23a1ba5676b9
Showing with 8 additions and 0 deletions.
  1. +8 −0 lib/occi/collection.rb
View
@@ -25,6 +25,14 @@ def initialize(collection={}, model = Occi::Model.new)
@action = Occi::Core::Action_instance.new(collection.action, collection.attributes) if collection.action
end
+ def <<(object)
+ object.kind_of? Occi::Core::Kind and self.kinds << object
+ object.kind_of? Occi::Core::Mixin and self.mixins << object
+ object.kind_of? Occi::Core::Action and self.actions << object
+ object.kind_of? Occi::Core::Resource and self.resources << object
+ object.kind_of? Occi::Core::Link and self.links << object
+ end
+
def ==(category)
not intersect(category).empty?
end

0 comments on commit d03b1da

Please sign in to comment.