# File lib/needle/pipeline/collection.rb, line 73
      def add( *args, &block )
        name = priority = nil
        options = {}
        klass = nil
        element = nil

        if [ Symbol, String ].any? { |i| args.first.is_a?( i ) }
          name = args.shift.to_s.intern
        end
        priority = args.shift if args.first.is_a?( Numeric )
        klass = args.shift if args.first.respond_to?( :new ) && block.nil?
        options = args.shift if args.first.is_a?( Hash )

        raise ArgumentError,
          "bad argument list #{args.inspect}" unless args.empty?

        if block
          element = BlockElement.new( @service_point, name, priority,
            options, block )
        else
          klass ||= @service_point.container[:pipeline_elements].fetch( name )
          element = klass.new( @service_point, name, priority, options )
        end

        @elements << element
        self
      end