def self.extract_await_ac(atts)
direction, type, value =
atts.collect { |k, v|
if k == :await && m = AAWAIT_R.match(v)
[ m[1] || 'in', m[2], m[3] ]
elsif k == :await && v.index(':').nil?
[ 'left', 'tag', v ]
elsif m = SPLIT_R.match(k)
[ m[1] || 'in', m[2], v ]
else
nil
end
}.compact.first
return nil if direction == nil
action =
if type == 'tag'
INS.include?(direction) ? 'entered_tag' : 'left_tag'
elsif type == 'participant'
INS.include?(direction) ? 'dispatch' : 'receive'
else
'error_intercepted'
end
value = Ruote.comma_split(value)
condition =
if type == 'participant'
{ 'participant_name' => value }
elsif type == 'error'
h = { 'class' => [], 'message' => [] }
value.each { |e| (KLASS_R.match(e) ? h['class'] : h['message']) << e }
h.delete_if { |k, v| v == nil or v == [] }
else
{ (value.first.to_s.match(/\//) ? 'full_tag' : 'tag') => value }
end
[ action, condition ]
end