class Syskit::Models::SpecializationManager::SpecializationBlockContext
Class used to give a proper evaluation context to the specialization blocks
Its job is to make sure that the composition that is being modified by the specialization block “looks like” the plain composition plus the specialization, regardless of all the other specializations that have been applied
Attributes
model[R]
The final composition model (i.e. the one on which the specialization is being applied)
overload_info[R]
The overload information
@return [Models::FacetedAccess]
reference_model[R]
The composition model that is made of the root model and only the relevant specialization applied
Public Class Methods
new(model, reference_model)
click to toggle source
# File lib/syskit/models/specialization_manager.rb, line 409 def initialize(model, reference_model) @model, @reference_model = model, reference_model @overload_info = ::Hash.new end
Public Instance Methods
apply_block(block)
click to toggle source
# File lib/syskit/models/specialization_manager.rb, line 415 def apply_block(block) if !model.definition_blocks.include?(block) instance_eval(&block) model.definition_blocks << block end end
method_missing(m, *args, &block)
click to toggle source
# File lib/syskit/models/specialization_manager.rb, line 426 def method_missing(m, *args, &block) if m =~ /_child$/ child_name = $` if info = overload_info[child_name] info else child = model.public_send(m, *args, &block) ref_child = reference_model.public_send(m, *args, &block) overload_info[name] = Child.new(child, ref_child) end else model.send(m, *args, &block) end end
respond_to_missing?(symbol, include_private)
click to toggle source
Calls superclass method
# File lib/syskit/models/specialization_manager.rb, line 422 def respond_to_missing?(symbol, include_private) model.respond_to?(symbol) || super end