I CAN HAZ 3K FRAIMWURK?
judofyr at gmail.com
Fri Jan 23 17:09:34 EST 2009
Hey, campers! I've been messin' with camping.rb again :-)
I've ported the flipbook template to RDoc 2 (RDoc 1 has always had problems
with building the docs at my computer)
Since we save all the applications in Camping::Apps we can easily figure out
which apps are defined when a file is loaded. I've refactored
Camping::Server and Camping::Reloader (truly a refactoring - mostly just
moved the bytes around) and now we no longer need to name our file the same
as the app. You can also define multiple apps in one file and
Camping::Reloader will work just as expected.
The @response object was never really used, so now we're creating it
on-demand in #to_a. Save quite a few bytes.
It has always annoyed me that if you overwrite r404, r500 or r501 you also
need to set the @status. Now we're doing a @status = @method =~ /r(\d+)/ ?
$1.to_i : 200, so the default status will be set to 404, 500 or 501 in those
methods. We also had a sexy r500 even though we sent all the errors to
Rack::ShowExceptions (again, many bytes saved by removing that).
I've also replaced Camping.method_missing to use Rack::MockRequest which is
shorter and more solid.
Camping now supports nested params (post[title]=Hello&post[body]=World).
See http://judofyr.net/posts/when-in-doubt.html for more information.
Before, class PostX would route to /post/(\w+), just to be sure to catch
everything I replaced it with /post/([^/]+) (everything until next slash)
which makes more sense IMO
After synchronizing camping.rb and camping-unabridged.rb, camping.rb ended
up at 2947 and we have now passed the 3k limit :D
Any thoughts? There's still missing a lot of documentation and I guess we
should add some tests too.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Camping-list