mperham/sidekiq — pull request #595 by jackrg (2012-12-19 06:02:38+00:00)
Title: Add new middleware chain methods for insertion into the middle of the list

Added the methods `#add_before(oldklass, newklass, *args)` and `#add_after(oldklass, newklass, *args)` to facilitate insertion immediately before and after (respectively) an existing middleware class. If the class does not exist, the insertion takes place at the top and bottom (respectively) of the chain. To insert at the top of the chain, you could write `chain.add_before(nil, MyServerHook)`.

Mike, please note that I cannot get the tests to run on my machine. Nevertheless, I believe they should work (as does the code, which I've tested in my application).