Class/Module Index [+]

Quicksearch

Ruote::Exp::EqualsExpression

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 :

and

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

Constants

OTHER_REGEX

Public Instance Methods

apply() click to toggle source
# 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

Protected Instance Methods

grab_value(k) click to toggle source
# File lib/ruote/exp/fe_equals.rb, line 99
def grab_value (k)

  attval = attribute(k)

  if m = OTHER_REGEX.match(k)
    k = m[1]
  end

  case k
    when /^f/ then h.applied_workitem['fields'][attval]
    when /^var/ then lookup_variable(attval)
    when /^val/ then attval
  end
end
grab_values() click to toggle source
# File lib/ruote/exp/fe_equals.rb, line 92
def grab_values

  keys = attributes.keys.select { |k| ! COMMON_ATT_KEYS.include?(k) }

  keys.collect { |k| grab_value(k) }
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.