lib/ruote/exp/fe_subprocess.rb in ruote-2.1.10 vs lib/ruote/exp/fe_subprocess.rb in ruote-2.1.11

- old
+ new

@@ -20,11 +20,11 @@ # THE SOFTWARE. # # Made in Japan. #++ -require 'ruote/subprocess' +require 'ruote/util/subprocess' module Ruote::Exp # @@ -151,10 +151,12 @@ names :subprocess def apply + return invoke_engine_participant if attribute(:engine) + ref = attribute(:ref) || attribute_text raise "no subprocess referred in #{tree}" unless ref pos, subtree = Ruote.lookup_subprocess(self, ref) @@ -162,9 +164,26 @@ vars = compile_atts vars.merge!('tree' => tree_children.first) # NOTE : we're taking the first child here... launch_sub(pos, subtree, :variables => vars) + end + + protected + + def invoke_engine_participant + + atts = tree[1] + + if ref = atts.find { |k, v| v.nil? } + ref = ref.first + atts.delete(ref) + end + atts['pdef'] = atts['ref'] || ref + atts['ref'] = atts.delete('engine') + + @h['name'] = 'participant' + Ruote::Exp::ParticipantExpression.new(@context, @h).apply end end end