lib/openwfe/participants/participant_map.rb
#
# Adds a participant to this map.
# This method is called by the engine's own register_participant()
# method.
#
# The participant instance is returned by this method call.
#
# The know params are :participant (a participant instance or
# class) and :position (which can be null or :first).
#
# By default (if :position is not set to :first), the participant
# will appear at the bottom of the participant list.
#
Adds a participant to this map.
This method is called by the engine's own register_participant()
method.

The participant instance is returned by this method call.

The know params are :participant (a participant instance or
class) and :position (which can be null or :first).

By default (if :position is not set to :first), the participant
will appear at the bottom of the participant list.
Adds a participant to this map . This method is called by the engine ' s own register_participant () method . The participant instance is returned by this method call . The know params are : participant ( a participant instance or class ) and : position ( which can be null or : first ) . By default ( if : position is not set to : first ) the participant will appear at the bottom of the participant list .
def register_participant (regex, params, &block)
      participant = params[:participant]
      position = params[:position]
      if not participant
        raise "please provide a participant instance or a block" unless block
        participant = BlockParticipant.new(block)
      end
      ldebug { "register_participant() participant.class {participant.class}" }
      participant = instantiate_participant(regex, participant, params) \
        if participant.is_a?(Class)
      participant.application_context = @application_context \
        if participant.respond_to?(:application_context=)
           note that since 0.9.21 the application_context is passed in
           the participant options as well.
      original_string = regex.to_s
      unless regex.is_a?(Regexp)
        regex = regex.to_s
        regex = '^' + regex unless regex[0, 1] == '^'
        regex = regex  + '$' unless regex[-1, 1] == '$'
        ldebug { "register_participant() '{regex}'" }
        regex = Regexp.new(regex)
      end
      class << regex
        attr_reader :original_string
      end
      regex.instance_variable_set('@original_string', original_string)
       now add the participant to the list
      entry = [ regex, participant ]
      index = (position == :first) ? 0 : -1
      @participants.insert(index, entry)
      participant
    end
def register_participant ( regex , params , & block ) participant = params [ :participant ] position = params [ :position ] if not participant raise "please provide a participant instance or a block" unless block participant = BlockParticipant . new ( block ) end ldebug { "register_participant() participant.class #{participant.class}" } participant = instantiate_participant ( regex , participant , params ) if participant . is_a? ( Class ) participant . application_context = @application_context if participant . respond_to? ( :application_context= ) original_string = regex . to_s unless regex . is_a? ( Regexp ) regex = regex . to_s regex = '^' + regex unless regex [ 0 , 1 ] == '^' regex = regex + '$' unless regex [ - 1 , 1 ] == '$' ldebug { "register_participant() '#{regex}'" } regex = Regexp . new ( regex ) end class << regex attr_reader :original_string end regex . instance_variable_set ( '@original_string' , original_string ) entry = [ regex , participant ] index = ( position == :first ) ? 0 : - 1 @participants . insert ( index , entry ) participant end
Adds a participant to this map.
Adds a participant to this map .
# # note that since 0.9.21 the application_context is passed in # the participant options as well. # now add the participant to the list
regex
<not_specific>
params
<not_specific>
block
<not_specific>