ruby implementation of levenshtein distance