# 
# prochandler.rb -- ProcHandler Class
#       
# Author: IPR -- Internet Programming with Ruby -- writers
# Copyright (C) 2001 TAKAHASHI Masayoshi, GOTOU Yuuzou
#   
# $IPR: prochandler.rb,v 1.2 2002/02/05 20:20:40 gotoyuzo Exp $

require 'webrick/httpservlet/abstract.rb'

module WEBrick
  module HTTPServlet

    class ProcHandler < AbstractServlet
      require_path_info false

      def get_instance(config, *options)
        self
      end  

      def require_path_info?
        type.require_path_info?
      end

      def initialize(proc)
        @proc = proc
      end

      def do_GET(request, response)
        @proc.call(request, response)
      end

      alias do_POST do_GET
    end

  end
end
