Class: Occi::Core::Mixin
- Includes:
- Helpers::Locatable
- Defined in:
- lib/occi/core/mixin.rb
Overview
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.
Direct Known Subclasses
Infrastructure::Mixins::OsTpl, Infrastructure::Mixins::ResourceTpl, InfrastructureExt::Mixins::AvailabilityZone, InfrastructureExt::Mixins::Floatingippool, InfrastructureExt::Mixins::Region
Constant Summary
Constants included from Helpers::IdentifierValidator
Helpers::IdentifierValidator::PROHIBITED_SCHEMA_CHARS, Helpers::IdentifierValidator::REGEXP_TERM
Constants included from Helpers::Renderable
Helpers::Renderable::RENDERER_FACTORY_CLASS
Instance Attribute Summary collapse
-
#actions ⇒ Set
list of ‘Action` instances attached to this mixin instance.
-
#applies ⇒ Set
list of ‘Kind` instances to which this mixin can be applied.
-
#depends ⇒ Set
list of ‘Mixin` instances on which this mixin depends.
-
#location ⇒ URI
protocol agnostic location of this mixin instance.
Attributes inherited from Category
#attributes, #identifier, #schema, #term, #title
Instance Method Summary collapse
-
#applies?(kind) ⇒ TrueClass, FalseClass
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).
-
#depends?(mixin) ⇒ TrueClass, FalseClass
Checks whether the given mixin is in the dependency chains of this instance.
Methods inherited from Category
#==, #eql?, #hash, #initialize, #to_s, #valid!, #valid?
Methods included from Helpers::IdentifierValidator
#prohibited_chars!, #valid_identifier!, #valid_identifier?, #valid_schema!, #valid_schema?, #valid_term!, #valid_term?, #valid_uri!
Methods included from Helpers::YamlSummoner
#from_yaml, #needs_dereferencing?
Methods included from Helpers::AttributesAccessor
Methods included from Helpers::Renderable
extended, included, #render, #renderer_factory, renderer_factory, renderer_factory_class, #renderer_for
Constructor Details
This class inherits a constructor from Occi::Core::Category
Instance Attribute Details
#actions ⇒ Set
list of ‘Action` instances attached to this mixin instance
18 19 20 |
# File 'lib/occi/core/mixin.rb', line 18 def actions @actions end |
#applies ⇒ Set
list of ‘Kind` instances to which this mixin can be applied
18 19 20 |
# File 'lib/occi/core/mixin.rb', line 18 def applies @applies end |
#depends ⇒ Set
list of ‘Mixin` instances on which this mixin depends
18 19 20 |
# File 'lib/occi/core/mixin.rb', line 18 def depends @depends end |
#location ⇒ URI
protocol agnostic location of this mixin instance
18 19 20 |
# File 'lib/occi/core/mixin.rb', line 18 def location @location end |
Instance Method Details
#applies?(kind) ⇒ TrueClass, FalseClass
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).
45 46 47 48 |
# File 'lib/occi/core/mixin.rb', line 45 def applies?(kind) return false unless applies && kind applies.include? kind end |
#depends?(mixin) ⇒ TrueClass, FalseClass
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.
31 32 33 34 |
# File 'lib/occi/core/mixin.rb', line 31 def depends?(mixin) return false unless depends && mixin depends.include? mixin end |