I was looking at my old blog posts and saw this one ( Flexible Sort ) from about a year and a half ago. I thought I'd tweak it a bit and see if I could make it more useful. Below is what you see I've come up with. I've made the calling code off of array instead of a static method on the class type. I like it better. If anyone sees improvements they want to do with it then feel free to fork the gist on github. :) I'll probably throw some tests on this bad boy, gemify it , and throw it up on gemcutter eventually.