| Module | OpenWFE::ValueMixin |
| In: |
lib/openwfe/expressions/value.rb
|
A small mixin providing value for looking up the attributes variable/var/v and field/fld/f.
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.
# File lib/openwfe/expressions/value.rb, line 53
53: def apply (workitem)
54:
55: escape = lookup_boolean_attribute('escape', workitem, false)
56:
57: if @children.length < 1
58:
59: workitem.attributes[FIELD_RESULT] =
60: lookup_value workitem, :escape => escape
61:
62: reply workitem
63: return
64: end
65:
66: child = @children[0]
67:
68: if child.kind_of?(OpenWFE::FlowExpressionId)
69:
70: handle_child child, workitem
71: return
72: end
73:
74: workitem.attributes[FIELD_RESULT] =
75: fetch_text_content workitem, escape
76:
77: reply workitem
78: end
# File lib/openwfe/expressions/value.rb, line 85
85: def lookup_field_attribute (workitem)
86:
87: lookup [ "field", "fld", "f" ], workitem
88: end
# File lib/openwfe/expressions/value.rb, line 80
80: def lookup_variable_attribute (workitem)
81:
82: lookup [ "variable", "var", "v" ], workitem
83: end
# File lib/openwfe/expressions/value.rb, line 92
92: def handle_child (child, workitem)
93:
94: raw_child, _fei = get_expression_pool.fetch(child)
95:
96: if raw_child.is_definition?
97:
98: #body_fei = get_expression_pool.evaluate child, workitem
99: #workitem.attributes[FIELD_RESULT] = body_fei
100:
101: workitem.attributes[FIELD_RESULT] = raw_child
102: #
103: # storing the child raw expression
104:
105: reply workitem
106: else
107:
108: get_expression_pool.apply raw_child, workitem
109: end
110: end