Module: Roby::Planning::MethodInheritance

Included in:
MethodDefinition, MethodModel
Defined in:
lib/roby/planning/model.rb

Overview

This mixin defines the method inheritance validation method. This is then used by MethodDefinition and MethodModel

Instance Method Summary collapse

Instance Method Details

#validate(options) ⇒ Object

Checks that options in options can be used to overload self. Updates options if needed



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/roby/planning/model.rb', line 87

def validate(options)
    if returns 
        if options[:returns] && !(options[:returns] <= returns)
            raise ArgumentError, "return task type #{options[:returns]} forbidden since it overloads #{returns}"
        else
            options[:returns] ||= returns
        end
    end

    if self.options.has_key?(:reuse)
        if options.has_key?(:reuse) && options[:reuse] != self.options[:reuse]
            raise ArgumentError, "the :reuse option is already set on the #{name} model"
        end
        options[:reuse] = self.options[:reuse]
    else
        options[:reuse] = true unless options.has_key?(:reuse)
    end

    options
end