class Occi::Core::Mixin

Defines the extension mechanism of the OCCI Core Model. The `Mixin` instance can be used to add `actions`, `attributes`, and custom features to existing `Entity` instances based on a specific `Kind` instance. A `Mixin` instance may depend on other `Mixin` instances (see `#depends`) and may be applied only to `Entity` instances based on specified `Kind` instances (see `#applies`). Some `Mixin` instances have special meaning defined in OCCI Standard documents.

@attr actions [Set] list of `Action` instances attached to this mixin instance @attr depends [Set] list of `Mixin` instances on which this mixin depends @attr applies [Set] list of `Kind` instances to which this mixin can be applied @attr location [URI] protocol agnostic location of this mixin instance

@author Boris Parak <parak@cesnet.cz>

Attributes

actions[RW]
applies[RW]
depends[RW]
location[W]

Public Instance Methods

applies?(kind) click to toggle source

Checks whether the given kind is in the applies set of this instance (i.e., this mixin can be applied to an `Entity` instance of the given kind). Checking for applicable kinds is strictly flat (no transitivity is applied). One `Mixin` instance may be applied to multiple kinds (`Entity` instances of the given kind).

@param kind [Kind] candidate instance @return [TrueClass, FalseClass] result

# File lib/occi/core/mixin.rb, line 45
def applies?(kind)
  return false unless applies && kind
  applies.include? kind
end
depends?(mixin) click to toggle source

Checks whether the given mixin is in the dependency chains of this instance. Checking for dependencies is strictly flat (no transitivity is applied). One `Mixin` instance may depend on multiple other instances.

@param mixin [Mixin] candidate instance @return [TrueClass, FalseClass] result

# File lib/occi/core/mixin.rb, line 31
def depends?(mixin)
  return false unless depends && mixin
  depends.include? mixin
end