Class OpenWFE::ComparisonExpression
In: lib/openwfe/expressions/fe_equals.rb
Parent: FlowExpression

A parent class for the ‘equals’ expression.

(there should be a ‘greater-than’ and a ‘lesser-than’ expression, but there are not that needed for now).

Methods

Included Modules

LookupMixin

Public Instance methods

[Source]

     # File lib/openwfe/expressions/fe_equals.rb, line 107
107:         def apply (workitem)
108: 
109:             #
110:             # preparing for children handling... later...
111:             #
112: 
113:             reply workitem
114:         end

[Source]

     # File lib/openwfe/expressions/fe_equals.rb, line 116
116:         def reply (workitem)
117: 
118:             value_a, value_b = lookup_values workitem
119: 
120:             result = compare value_a, value_b
121: 
122:             ldebug { "apply() result is '#{result}'  #{@fei.to_debug_s}" }
123: 
124:             workitem.set_result result
125: 
126:             reply_to_parent workitem
127:         end

Protected Instance methods

The bulk job of looking up the values to compare

[Source]

     # File lib/openwfe/expressions/fe_equals.rb, line 134
134:             def lookup_values (workitem)
135: 
136:                 value_a = lookup_value workitem
137:                 value_b = lookup_value workitem, :prefix => 'other'
138: 
139:                 value_c = lookup_variable_or_field_value workitem
140: 
141:                 if not value_a and value_b
142:                     value_a = value_c
143:                 elsif value_a and not value_b
144:                     value_b = value_c
145:                 end
146: 
147:                 [ value_a, value_b ]
148:             end

Returns the value pointed at by the variable attribute or by the field attribute, in that order.

[Source]

     # File lib/openwfe/expressions/fe_equals.rb, line 154
154:             def lookup_variable_or_field_value (workitem)
155: 
156:                 lookup_var_value(workitem) || lookup_field_value(workitem)
157:             end

[Validate]