1 #
2 # prochandler.rb -- ProcHandler Class
3 #
4 # Author: IPR -- Internet Programming with Ruby -- writers
5 # Copyright (c) 2001 TAKAHASHI Masayoshi, GOTOU Yuuzou
6 # Copyright (c) 2002 Internet Programming with Ruby writers. All rights
7 # reserved.
8 #
9 # $IPR: prochandler.rb,v 1.7 2002/09/21 12:23:42 gotoyuzo Exp $
10
11 require 'webrick/httpservlet/abstract.rb'
12
13 module WEBrick
14 module HTTPServlet
15
16 class ProcHandler < AbstractServlet
17 def get_instance(server, *options)
18 self
19 end
20
21 def initialize(proc)
22 @proc = proc
23 end
24
25 def do_GET(request, response)
26 @proc.call(request, response)
27 end
28
29 alias do_POST do_GET
30 end
31
32 end
33 end