I've an example of this that's ~100 lines of code, if you're interested.
Maps URLs to classes and templates and renders them, using erb and Webrick.
I'd like to see it, just because I might find it educational.
I've also been wondering if framework support for this sort of thing, but
very simple to setup, would be useful to people?
Something akin to this:
app.rb
-----
require 'iowa'
Iowa.run
-----
app.cnf
-----
socket:
hostname: foo.bar.com
port: 3000
application:
dispatcher:
class: StandardDispatcher
mapfile: mapfile.cnf
-----
mapfile.cnf:
-----
:map:
/index.html: Index
/form.html: Myform
/response.html: Myresponse
-----
If one had an index.rhtml, myform.rhtml, and myresponse.rhtml, they would
be mapped to classes Index, Myform, and Myresponse, and requests for the
urls above would go to the class in question and be rendered as an erb
template.
You'd run it with:
ruby app.rb -r webrick
or
ruby app.rb -r mongrel
No other code or config necessary to serve those rhtml files. Would
anyone use this ability (as I personally would not). Worth my time to
make the above work?
Kirk haines