Module: OpenWFE::TemplateMixin

Included in:
MailParticipant
Defined in:
lib/openwfe/participants/participants.rb

Overview

This mixin provides an eval_template() method. This method assumes the target class has a @block_template and a @template, it also assumes the class includes the module LocalParticipant.

This mixin is used for example in the MailParticipant class.

Instance Method Summary collapse

Instance Method Details

#eval_template(workitem) ⇒ Object

Given a workitem, expands the template and returns it as a String.



373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/openwfe/participants/participants.rb', line 373

def eval_template (workitem)

    fe = get_flow_expression workitem

    template = if @block_template

        call_block @block_template, workitem

    elsif @template

        template = if @template.kind_of?(File)
            @template.readlines
        else
            @template.to_s
        end

    else

        nil
    end

    return "(no template given)" unless template

    OpenWFE::dosub template, fe, workitem
end