Class: Syskit::Models::Composition::DynamicServiceInstantiationContext Private

Inherits:
DynamicDataService::InstantiationContext show all
Defined in:
lib/syskit/models/composition.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Context object under which the dynamic data service blocks are evaluated

The composition's version adds the ability to access the children and require dynamic services on them

Defined Under Namespace

Classes: Child

Instance Attribute Summary

Attributes inherited from DynamicDataService::InstantiationContext

#component_model, #dynamic_service, #name, #options, #service

Instance Method Summary collapse

Methods inherited from DynamicDataService::InstantiationContext

#argument, #driver_for, #provides

Constructor Details

#initialize(component_model, name, dynamic_service, **options) ⇒ DynamicServiceInstantiationContext

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of DynamicServiceInstantiationContext



570
571
572
573
# File 'lib/syskit/models/composition.rb', line 570

def initialize(component_model, name, dynamic_service, **options)
    @specialized = Set.new
    super
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



605
606
607
608
609
610
611
# File 'lib/syskit/models/composition.rb', line 605

def method_missing(m, *args, &block)
    if m =~ /_child$/
        Child.new(self, component_model.public_send(m, *args, &block))
    else
        super
    end
end

Instance Method Details

#add(*args, **options, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



588
589
590
591
# File 'lib/syskit/models/composition.rb', line 588

def add(*args, **options, &block)
    child = component_model.add(*args, **options, &block)
    Child.new(self, child)
end

#export(port, **options) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



584
585
586
# File 'lib/syskit/models/composition.rb', line 584

def export(port, **options)
    component_model.export(port, **options)
end

#overload(*args, **options, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



593
594
595
596
# File 'lib/syskit/models/composition.rb', line 593

def overload(*args, **options, &block)
    child = component_model.overload(*args, **options, &block)
    Child.new(self, child)
end

#respond_to_missing?(m, include_private) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


598
599
600
601
602
603
# File 'lib/syskit/models/composition.rb', line 598

def respond_to_missing?(m, include_private)
    if m =~ /_child$/
        component_model.respond_to?(m)
    else super
    end
end

#specialized_child(child) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



575
576
577
578
579
580
581
582
# File 'lib/syskit/models/composition.rb', line 575

def specialized_child(child)
    child_name = child.child_name
    if !@specialized.include?(child_name)
        @specialized << child_name
        component_model.overload child_name, child.specialize
    end
    component_model.find_child(child_name)
end