def apply
param = case name
when 'skip', 'back' then attribute(:step) || attribute_text
when 'jump' then attribute(:to) || attribute_text
else nil
end
param = Integer(param) rescue param
command_workitem = Ruote.fulldup(h.applied_workitem)
set_command(command_workitem, name, param)
target = parent
ancestor = true
if ref = attribute(:ref)
fei = lookup_variable(ref)
target = Ruote.is_a_fei?(fei) ?
Ruote::Exp::FlowExpression.fetch(@context, fei) : nil
target = target.is_a?(Ruote::Exp::CommandedExpression) ?
target : nil
ancestor = target ? ancestor?(target.h.fei) : false
else
target = fetch_command_target
end
return reply_to_parent(h.applied_workitem) if target.nil?
return reply_to_parent(command_workitem) if target.h.fei == h.parent_id
@context.storage.put_msg(
'reply',
'fei' => target.h.fei,
'workitem' => command_workitem,
'command' => [ name, param ])
reply_to_parent(h.applied_workitem) unless ancestor
end