lib/ruote/log/wait_logger.rb
def matches(interests, msg)

      action = msg['action']

      interests.each do |interest|

        satisfied = case interest

          when :or_error
            #
            # let's force an immediate reply

            interests.clear if action == 'error_intercepted'

          when :inactive

            (FINAL_ACTIONS.include?(action) && @context.worker.inactive?)

          when :empty

            (action == 'terminated' && @context.storage.empty?('expressions'))

          when Symbol

            (action == 'dispatch' && msg['participant_name'] == interest.to_s)

          when Fixnum

            interests.delete(interest)

            if (interest > 1)
              interests << (interest - 1)
              false
            else
              true
            end

          when Hash

            interest.all? { |k, v|
              k = 'tree.0' if k == 'exp_name'
              Ruote.lookup(msg, k) == v
            }

          when /^[a-z_]+$/

            (action == interest)

          else # wfid

            (FINAL_ACTIONS.include?(action) && msg['wfid'] == interest)
        end

        interests.delete(interest) if satisfied
      end

      if interests.include?(:or_error)
        (interests.size < 2)
      else
        (interests.size < 1)
      end
    end
# Checks whether message msg matches any of interests being waited for.
#
# Some interests look for actions on particular workflows (e.g.,
# waiting for some workflow to finish). Other interests are not
# attached to any particular workflow (e.g., :inactive waits until
# the engine finishes processing all active and pending workflows)
# but are still satisfied when actions happen on workflows (e.g.,
# the last workflow being run finishes).
#
# Returns true if all interests being waited for have been satisfied,
# false otherwise.
#
Checks whether message msg matches any of interests being waited for.
Some interests look for actions on particular workflows . Other interests are not
attached to any particular workflow
but are still satisfied when actions happen on workflows .

Returns true if all interests being waited for have been satisfied,
false otherwise.
Checks whether message msg matches any of interests being waited for . Some interests look for actions on particular workflows . Other interests are not attached to any particular workflow but are still satisfied when actions happen on workflows . Returns true if all interests being waited for have been satisfied false otherwise .
def matches(interests, msg)
      action = msg['action']
      interests.each do |interest|
        satisfied = case interest
          when :or_error
             let's force an immediate reply
            interests.clear if action == 'error_intercepted'
          when :inactive
            (FINAL_ACTIONS.include?(action) && @context.worker.inactive?)
          when :empty
            (action == 'terminated' && @context.storage.empty?('expressions'))
          when Symbol
            (action == 'dispatch' && msg['participant_name'] == interest.to_s)
          when Fixnum
            interests.delete(interest)
            if (interest > 1)
              interests << (interest - 1)
              false
            else
              true
            end
          when Hash
            interest.all? { |k, v|
              k = 'tree.0' if k == 'exp_name'
              Ruote.lookup(msg, k) == v
            }
          when /^[a-z_]+$/
            (action == interest)
          else  wfid
            (FINAL_ACTIONS.include?(action) && msg['wfid'] == interest)
        end
        interests.delete(interest) if satisfied
      end
      if interests.include?(:or_error)
        (interests.size < 2)
      else
        (interests.size < 1)
      end
    end
def matches ( interests , msg ) action = msg [ 'action' ] interests . each do | interest | satisfied = case interest when :or_error interests . clear if action == 'error_intercepted' when :inactive ( FINAL_ACTIONS . include? ( action ) && @context . worker . inactive? ) when :empty ( action == 'terminated' && @context . storage . empty? ( 'expressions' ) ) when Symbol ( action == 'dispatch' && msg [ 'participant_name' ] == interest . to_s ) when Fixnum interests . delete ( interest ) if ( interest > 1 ) interests << ( interest - 1 ) false else true end when Hash interest . all? { | k , v | k = 'tree.0' if k == 'exp_name' Ruote . lookup ( msg , k ) == v } when / ^[a-z_]+$ / ( action == interest ) else ( FINAL_ACTIONS . include? ( action ) && msg [ 'wfid' ] == interest ) end interests . delete ( interest ) if satisfied end if interests . include? ( :or_error ) ( interests . size < 2 ) else ( interests . size < 1 ) end end
Checks whether message msg matches any of interests being waited for.
Checks whether message msg matches any of interests being waited for .
# # let's force an immediate reply # wfid
interests
msg