Module: Roby::TaskStructure::Dependency::ModelExtension
- Defined in:
- lib/roby/task_structure/dependency.rb
Instance Method Summary collapse
-
#each_fullfilled_model {|model| ... } ⇒ void
Enumerates the models that all instances of this task model fullfill.
-
#explicit_fullfilled_model ⇒ nil, Array<Models::Task,TaskService>
Returns an explicitly set #fullfilled_model.
-
#explicit_fullfilled_model? ⇒ Boolean
True if a fullfilled model has been explicitly set on self.
-
#fullfilled_model ⇒ Object
Returns the model that all instances of this taks model fullfill.
-
#fullfilled_model=(models) ⇒ Object
Specifies the models that all instances of this task must fullfill.
-
#implicit_fullfilled_model ⇒ Array<Models::Task,TaskService>
private
The list of models fullfilled by this task.
Instance Method Details
#each_fullfilled_model {|model| ... } ⇒ void
This method returns an undefined value.
Enumerates the models that all instances of this task model fullfill
872 873 874 |
# File 'lib/roby/task_structure/dependency.rb', line 872 def each_fullfilled_model(&block) fullfilled_model.each(&block) end |
#explicit_fullfilled_model ⇒ nil, Array<Models::Task,TaskService>
Returns an explicitly set #fullfilled_model
820 821 822 |
# File 'lib/roby/task_structure/dependency.rb', line 820 def explicit_fullfilled_model @fullfilled_model end |
#explicit_fullfilled_model? ⇒ Boolean
True if a fullfilled model has been explicitly set on self
812 813 814 |
# File 'lib/roby/task_structure/dependency.rb', line 812 def explicit_fullfilled_model? !!@fullfilled_model end |
#fullfilled_model ⇒ Object
Returns the model that all instances of this taks model fullfill
(see Dependency::Extension#fullfilled_model)
864 865 866 |
# File 'lib/roby/task_structure/dependency.rb', line 864 def fullfilled_model explicit_fullfilled_model || implicit_fullfilled_model end |
#fullfilled_model=(models) ⇒ Object
Specifies the models that all instances of this task must fullfill
This is usually used to under-constraint the model instances
829 830 831 832 833 834 835 836 837 |
# File 'lib/roby/task_structure/dependency.rb', line 829 def fullfilled_model=(models) if !models.respond_to?(:to_ary) raise ArgumentError, "expected an array, got #{models}" elsif !models.all? { |t| t.kind_of?(Roby::Models::TaskServiceModel) || (t.respond_to?(:<=) && (t <= Roby::Task)) } raise ArgumentError, "expected a submodel of TaskService, got #{models}" end @fullfilled_model = models end |
#implicit_fullfilled_model ⇒ Array<Models::Task,TaskService>
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 the list of models fullfilled by this task.
843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 |
# File 'lib/roby/task_structure/dependency.rb', line 843 def implicit_fullfilled_model unless @implicit_fullfilled_model @implicit_fullfilled_model = [] ancestors.each do |m| next if m.singleton_class? if m.kind_of?(Class) || (m.kind_of?(Roby::Models::TaskServiceModel) && m != Roby::TaskService) @implicit_fullfilled_model << m end if m == Roby::Task break end end end @implicit_fullfilled_model end |