Module: OpenWFE::ValueMixin

Overview

A small mixin providing value for looking up the attributes variable/var/v and field/fld/f.

Instance Method Summary collapse

Instance Method Details

#apply(workitem) ⇒ Object

Expressions that include the ValueMixin let it gather values and then, in their reply() methods do the job with the values. The gathering task is performed by the ValueMixin.



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/openwfe/expressions/value.rb', line 53

def apply (workitem)

    escape = lookup_boolean_attribute('escape', workitem, false)

    if @children.length < 1

        workitem.attributes[FIELD_RESULT] =
            lookup_value workitem, :escape => escape

        reply workitem
        return
    end

    child = @children[0]

    if child.kind_of?(OpenWFE::FlowExpressionId)

        handle_child child, workitem
        return
    end

    workitem.attributes[FIELD_RESULT] =
        fetch_text_content workitem, escape

    reply workitem
end

#lookup_field_attribute(workitem) ⇒ Object



85
86
87
88
# File 'lib/openwfe/expressions/value.rb', line 85

def lookup_field_attribute (workitem)

    lookup [ "field", "fld", "f" ], workitem
end

#lookup_variable_attribute(workitem) ⇒ Object



80
81
82
83
# File 'lib/openwfe/expressions/value.rb', line 80

def lookup_variable_attribute (workitem)

    lookup [ "variable", "var", "v" ], workitem
end