ruby gem and sorting matches