Class: Ruote::Exp::EqualsExpression

Inherits:
FlowExpression show all
Defined in:
lib/ruote/exp/fe_equals.rb

Overview

This expression fell out of favour a long ago. At first it was used with the 'if' expression :

_if do
  equals :field_value => 'customer', :other_value => 'British Petroleum'
  participant :ref => 'Allister'
end

but lately, the :test attribute of the 'if' expression is used :

_if :test => '${f:customer} == British Petroleum' do
  participant :ref => 'Allister'
end

In some cases, the 'if' expression vanishes and the :if attribute shared by all expressions is used :

participant :ref => 'Al', :if => '${f:customer} == British Petroleum'

attributes

The 'equals' expression accepts those attributes :

  • :value

  • :field_value

  • :variable_value

  • :val

  • :field_val

  • :variable_val

and

  • :other_value

  • :other_field_value

  • :other_variable_value

  • :other_val

  • :other_field_val

  • :other_variable_val

With a bit of luck, they make sense on their own.

Constant Summary

Constants inherited from FlowExpression

FlowExpression::COMMON_ATT_KEYS

Instance Attribute Summary

Attributes inherited from FlowExpression

#context, #error

Instance Method Summary collapse

Methods inherited from FlowExpression

#ancestor?, #applied_workitem, #att, #att_text, #attribute, #attribute_text, #attributes, #await, #cancel, #cancel_flanks, #cfei_at, #child_id, #child_ids, #compile_atts, #compile_variables, #debug_id, #deflate, #do, do_action, #do_apply, #do_cancel, #do_fail, #do_pause, #do_persist, #do_reply, #do_reply_to_parent, #do_resume, #do_unpersist, dummy, #fei, fetch, from_h, #handle_on_error, #has_attribute, #initial_persist, #initialize, #is_concurrent?, #iterative_var_lookup, #launch_sub, #lookup_val, #lookup_val_prefix, #lookup_variable, #name, names, #parent, #parent_id, #pause_on_apply, #persist_or_raise, #reply, #reply_to_parent, #root, #root_id, #set_variable, #tree, #tree_children, #try_persist, #try_unpersist, #unpersist_or_raise, #unset_variable, #update_tree, #variables, #wfid

Methods included from WithMeta

#class_def, included

Methods included from WithH

#h, #h=, included, #to_h

Constructor Details

This class inherits a constructor from Ruote::Exp::FlowExpression

Instance Method Details

#applyObject



75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/ruote/exp/fe_equals.rb', line 75

def apply

  vals = grab_values

  h.applied_workitem['fields']['__result__'] = if vals.size < 2
    false
  else
    (vals.first == vals.last)
  end

  reply_to_parent(h.applied_workitem)
end