insertion sort implementation in ruby