technoweenie/faraday — pull request #103 by mislav (2011-12-29 20:34:59+00:00)
Title: Add Faraday.register_middleware

Allows 3rd-party libraries to register named shortcuts to resolve to full qualified constant names for specific middleware.

Usage:

~~~ ruby
Faraday.register_middleware :aloha => MyModule::Aloha
Faraday.register_middleware :boom => MyModule::Boom, :type => :response
Faraday.register_middleware :lazy => lambda { ... }
~~~

Those shortcuts are then available in Builder:

~~~ ruby
builder.use :aloha
builder.response :boom
~~~

What do you think of the API?