class Roby::Coordination::Models::TaskFromVariable

State whose instanciation object is provided through a state machine variable

Attributes

variable_name[R]

Public Class Methods

new(variable_name, task_model) click to toggle source
Calls superclass method
# File lib/roby/coordination/models/task_from_variable.rb, line 8
def initialize(variable_name, task_model)
    @variable_name = variable_name
    super(task_model)
end

Public Instance Methods

instanciate(plan, variables = Hash.new) click to toggle source
# File lib/roby/coordination/models/task_from_variable.rb, line 13
def instanciate(plan, variables = Hash.new)
    obj = variables[variable_name]
    if !obj.respond_to?(:as_plan)
        raise ArgumentError, "expected variable #{variable_name} to contain an object that can generate tasks, found #{obj}"
    end
    obj.as_plan
end
to_s() click to toggle source
# File lib/roby/coordination/models/task_from_variable.rb, line 21
def to_s; "var(#{variable_name})[#{task_model}]" end