class Occi::Core::Mixins

Attributes

entity[RW]

Public Instance Methods

<<(mixin) click to toggle source
Calls superclass method Occi::Core::Categories#<<
# File lib/occi/core/mixins.rb, line 18
def <<(mixin)
  mixin = convert mixin
  @entity.attributes.merge! mixin.attributes.convert if @entity
  super mixin
end
entity=(entity) click to toggle source
# File lib/occi/core/mixins.rb, line 7
def entity=(entity)
  self.each { |mixin| entity.attributes.merge! mixin.attributes.convert }
  @entity = entity
end
remove(mixin) click to toggle source
# File lib/occi/core/mixins.rb, line 12
def remove(mixin)
  mixin = convert mixin
  @entity.attributes.remove mixin.attributes if @entity
  self.delete mixin
end

Private Instance Methods

convert(mixin) click to toggle source

TODO: fix mixin conversion

Calls superclass method Occi::Core::Categories#convert
# File lib/occi/core/mixins.rb, line 27
def convert(mixin)
  mixin = super mixin
  if mixin.kind_of? String
    mixin = Occi::Core::Mixin.new *mixin.split('#')
  end
  mixin
end