Camping 2.1: Rackification

Magnus Holm judofyr at
Mon Apr 12 10:32:06 EDT 2010

Rackification -

I want to make Camping even more Rack-ish. Some ideas:

1. Make Camping::Server use Rack::Server

2. The dispatcher shouldn't care about the method

Previously the dispatcher (Controllers.D) has taken a path and a
method, and returns an array with the controller and the method:

D("/", "get") # => [Index, 'get']
D("/", "post") # => [I, 'r501']  # no post-method in Index
D("/not_found", "get") # => [I, 'r404']

I want to make it such that the dispatcher only cares about the path,
and then the controllers are responsible for calling the right method.
I feel that is more HTTP-ish: First look up the resource, then try to
call the method.

3. When the method isn't found, call #method_missing

Okay, this one is kinda dangerous, but it would be cool if Camping
would call #method_missing if the method doesn't exist. That way,
Camping almost becomes the Ruby-version of HTTP. Too dangerous (aka.
it would swallow regular NoMethorError) or possible?

// Magnus Holm

More information about the Camping-list mailing list