module Syskit::Models::CompositionSpecialization::Extension
Additional methods that are mixed in composition specialization models. I.e. composition models created by CompositionModel#specialize
Attributes
The root composition model in the specialization chain
Public Instance Methods
Applies the specialization block block on self.
If recursive is true, also applies it on the children of this
particular specialization
Whenever a new specialization block is applied on an existing specialization, calling this method with recursive = true ensures that the block is applied on all specialization models that should have it applied
# File lib/syskit/models/composition_specialization.rb, line 43 def apply_specialization_block(block) if !definition_blocks.include?(block) instance_eval(&block) definition_blocks << block end end
Registers a new composition model that is a specialization of
self. The generated model is registered on the root model (not
this one)
# File lib/syskit/models/composition_specialization.rb, line 53 def instanciate_specialization(merged, list) return super if root_model == self applied_specializations.each do |s| merged.merge(s) end list = list + applied_specializations.to_a root_model.instanciate_specialization(merged, list) end
# File lib/syskit/models/composition_specialization.rb, line 8 def is_specialization?; true end
Returns the model name
This is formatted as root_model/child_name.is_a?(specialized_list),other_child.is_a?(…)
# File lib/syskit/models/composition_specialization.rb, line 20 def name return super if root_model == self specializations = self.specialized_children.map do |child_name, child_models| "#{child_name}.is_a?(#{child_models.map(&:short_name).join(",")})" end "#{root_model.short_name}/#{specializations}" end
# File lib/syskit/models/composition_specialization.rb, line 30 def setup_submodel(submodel, options = Hash.new) submodel.root_model = submodel super end