1 require 'http11' # for Mongrel::URIClassifier
4 # Users put Actions inside this module to be given automatic routing paths
10 # the keys of @classifiers are the HTTP methods
11 @classifiers = Hash.new
12 Chew::Request::METHODS.each do |m|
13 @classifiers[m.to_sym] = Mongrel::URIClassifier.new
15 load_all_module_routes
18 def load_all_module_routes
19 load_module_routes(Chew::Root, '/')
23 _, rel_path, action = @classifiers[request.method].resolve(request.path_info)
29 def load_module_routes(m, path)
30 m.submodules.each do |n|
31 n_path = File.join(path, n.last_name)
33 @classifiers[n.method].register(n_path, n)
35 load_module_routes(n, n_path)