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, #h

Instance Method Summary collapse

Methods inherited from FlowExpression

#ancestor?, #att, #attribute, #attribute_text, #attributes, #cancel, #compile_atts, #compile_variables, do_action, #do_apply, #do_cancel, #do_fail, #do_pause, #do_persist, #do_reply, #do_resume, #do_unpersist, #expand_atts, #fei, fetch, from_h, #handle_on_error, #has_attribute, #initial_persist, #initialize, #iterative_var_lookup, #launch_sub, #lookup_on_error, #lookup_val, #lookup_val_prefix, #lookup_variable, #name, names, #parent, #parent_id, #persist_or_raise, #reply, #reply_to_parent, #set_variable, #to_h, #tree, #tree_children, #try_persist, #try_unpersist, #unpersist_or_raise, #unset_variable, #update_tree, #variables

Methods included from WithMeta

#class_def, included

Methods included from WithH

included

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