Rewrite gem to perform placeholder replacement in Rack middleware

The original after_filter implementation doesn't work if the response is 
generated in a before_filter, as rails will not process the action/after 
filters.

This also has the side effect of not making the gem rails specific and in
theory this could now be used with sinatra/other rack compatible frameworks.