Update on Merb Routes

100% better, 50% leaner

Get the updated code for ripping Merb’s Router right out of Merb and into your own application at http://pastie.caboo.se/128965.

Updates

I promised I woud update you on a few things and since originally posting my steps to use Merb’s Router alone I have discovered numerous things in the process.

First, I have gotten rid of that ugly Req class that I made to wrap the proper HTTP request information in, but I’ve also gotten rid of the excess data and broken it down to simply needing the REQUEST_URI and REQUEST_METHOD properties.

In the process, I’ve also removed the dependency on Merb’s Request object and have instead opted for an anonymous Struct object doing a few of the steps that the Request object did for us manually. A small price to pay, in my opinion, as overhead is an issue.

To clear up the question as to whether the compile method was necessary, Ezra mentioned that it was called automatically when prepare is finished yielding so we do not need to worry about it.

Overall, I was able to strip and trim down the absolute essentials to roughly half of what I first portrayed, a great leap forward I think. I hope you can make some use of my work to make using Ezra’s great work better.

I do plan to package this work up into a Rack middleware app, so stay tuned.