Class: OpenWFE::CaseExpression
- Inherits:
-
FlowExpression
- Object
- ObjectWithMeta
- FlowExpression
- OpenWFE::CaseExpression
- Defined in:
- lib/openwfe/expressions/fe_if.rb
Overview
The ‘case’ expression.
<case>
<equals field="f0" other-value="ready" />
<participant ref="alpha" />
<if test="${supply_level} == ${field:supply_request}" />
<participant ref="bravo" />
<participant ref="charly" />
</case>
A generalized ‘if’. Will evaluate its children, expecting the order :
- condition
- consequence
- condition
- consequence
...
- else consequence (optional)
The ‘switch’ nickname can be used for ‘case’.
Instance Attribute Summary collapse
-
#evaluating_condition ⇒ Object
set to ‘true’ when the case expression is actually evaluating a condition (ie not triggering a consequence).
-
#offset ⇒ Object
keeping track of where we are in the case iteration.
Attributes inherited from FlowExpression
#apply_time, #attributes, #children, #environment_id, #fei, #parent_id, #raw_representation
Attributes included from Contextual
Instance Method Summary collapse
Methods inherited from FlowExpression
#cancel, #clean_children, #delete_variable, #dup_environment, #fetch_environment, #fetch_text_content, #get_binding, #get_environment, #get_parent, #get_root_environment, #has_attribute, #initialize, is_definition, is_definition?, #lookup_attribute, #lookup_attributes, #lookup_boolean_attribute, #lookup_comma_list_attribute, #lookup_downcase_attribute, #lookup_ref, #lookup_string_attribute, #lookup_sym_attribute, #lookup_value, #lookup_variable, #lookup_vf_attribute, names, #new_environment, new_exp, #owns_its_environment?, #paused?, #remove_child, #reply_to_parent, #set_variable, #store_itself, #synchronize, #to_s, #to_yaml_properties
Methods included from Contextual
#get_work_directory, #init_service, #lookup
Methods included from Logging
#ldebug, #ldebug_callstack, #lerror, #lfatal, #linfo, #llog, #lunknown, #lwarn
Methods included from OwfeServiceLocator
#get_engine, #get_error_journal, #get_expool, #get_expression_map, #get_expression_pool, #get_expression_storage, #get_expression_storages, #get_journal, #get_participant_map, #get_scheduler, #get_wfid_generator
Methods inherited from ObjectWithMeta
#class_def, meta_def, meta_eval, metaclass
Constructor Details
This class inherits a constructor from OpenWFE::FlowExpression
Instance Attribute Details
#evaluating_condition ⇒ Object
set to ‘true’ when the case expression is actually evaluating a condition (ie not triggering a consequence).
228 229 230 |
# File 'lib/openwfe/expressions/fe_if.rb', line 228 def evaluating_condition @evaluating_condition end |
#offset ⇒ Object
keeping track of where we are in the case iteration
222 223 224 |
# File 'lib/openwfe/expressions/fe_if.rb', line 222 def offset @offset end |
Instance Method Details
#apply(workitem) ⇒ Object
231 232 233 234 235 236 237 238 239 240 241 |
# File 'lib/openwfe/expressions/fe_if.rb', line 231 def apply (workitem) #workitem.unset_result # # since OpenWFEru 0.9.16 previous __result__ values # are not erased before a 'case'. @offset = nil trigger_child workitem, true end |
#reply(workitem) ⇒ Object
243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
# File 'lib/openwfe/expressions/fe_if.rb', line 243 def reply (workitem) if @evaluating_condition result = workitem.get_boolean_result #ldebug { "reply() result : '#{result.to_s}' (#{result.class})" } trigger_child workitem, !result else reply_to_parent workitem end end |