lib/openwfe/participants/participantmap.rb in openwferu-0.9.5 vs lib/openwfe/participants/participantmap.rb in openwferu-0.9.6
- old
+ new
@@ -77,14 +77,30 @@
if not block
participant = BlockParticipant.new(block)
end
+ ldebug do
+ "register_participant() "+
+ "participant class is #{participant.class}"
+ end
+
if participant.kind_of? Class
+
+ ldebug { "register_participant() class #{participant}" }
+
begin
+
participant = participant.new(regex, @application_context)
- rescue
+
+ rescue Exception => e
+ #ldebug do
+ # "register_participant() " +
+ # "falling back to no param constructor because of \n" +
+ # OpenWFE::exception_to_s(e)
+ #end
+
participant = participant.new
end
end
regex = Regexp.new(regex.to_s) unless regex.kind_of? Regexp
@@ -105,9 +121,25 @@
@participants.each do |tuple|
return tuple[1] if tuple[0].match(participant_name)
end
return nil
+ end
+
+ #
+ # Deletes the first participant matching the given name.
+ #
+ def unregister_participant (participant_name)
+
+ pos = -1
+ @participants.each_with_index do |tuple, index|
+ if tuple[0].match(participant_name)
+ pos = index
+ break
+ end
+ end
+ @participants.delete(pos) if pos > -1
+ return pos > -1
end
#
# Dispatches to the given participant.
# The workitem will be fed to the consume() method of that participant.