My own sort method in ruby