stephencelis/crepe — pull request #37 by kainosnoema (2014-01-02 07:29:58+00:00)
Title: Add support for 'around' callbacks and conditionals using proper chain

Middleware isn't always sufficient if you need access to endpoint values, e.g. parsed version and content-type. The 'around' filter is much more complex to implement, but the result is extremely flexible.

This brings Crepe callbacks much closer to ActiveSupport::Callbacks, without much of the complexity and compatibility issues that will come with actually using ActiveSupport::Callbacks. AS callbacks are stored
in class variables, meaning we can't have different chains for each endpoint instance, and we can't use the underlying AS classes because AS 4.1 rewrites the Callbacks implementation completely.

This does increase the stack depth significantly, so we'll probably want to do some benchmarks to make sure this isn't slowing things down unacceptably.