Rackable is a tiny module that aims to make any Ruby object Rack-friendly and provide it with a REST-like interface.
Basically, what it does is providing an object with a
call() method that
uses the Rack environement to dispatch to a method, giving helper objects such
as headers, query parameters, ...
You can run the specs by running
bacon on the
Bacon is available at
Look in the
Rackable provides a
rack readable attribute which is a struct containing the
env: the parameter for
Rack::Responseobject that is returned by
header: a hash of headers that is part of
Rack::Requestcreated from the environement given to
query: a hash of parameters extracted from the query string
data: a hash of parameters extracted from the request body (POST, PUT)
data, keys of the hash are symbols.
You can easily handle errors with the provided
http_error method. It takes an
error code and an optional message. If no message is given, the standard message
from the HTTP Status Codes list will be used (eg. Not Found for 404)