gnome sort implementation in ruby