lib/ruote/exp/fe_cursor.rb in ruote-2.3.0.1 vs lib/ruote/exp/fe_cursor.rb in ruote-2.3.0.2
- old
+ new
@@ -1,7 +1,7 @@
#--
-# Copyright (c) 2005-2012, John Mettraux, jmettraux@gmail.com
+# Copyright (c) 2005-2013, John Mettraux, jmettraux@gmail.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@@ -302,20 +302,19 @@
return pos if pos != nil
tree_children.each_with_index do |c, i|
- exp_name = c[0]
- ref = c[1]['ref']
- tag = c[1]['tag']
+ found = [
+ c[0], # exp_name
+ c[1]['ref'], # ref
+ c[1]['tag'], # tag
+ (c[1].find { |k, v| v.nil? } || []).first # participant 'xxx'
+ ].find do |v|
+ v ? (dsub(v, workitem) == arg) : false
+ end
- ref = dsub(ref, workitem) if ref
- tag = dsub(tag, workitem) if tag
-
- next if exp_name != arg && ref != arg && tag != arg
-
- pos = i
- break
+ if found then pos = i; break; end
end
pos ? pos : position
end
end