1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

fix bug in Levenshtein distance calculation

Bug was discovered and discussed in #18395.
This commit is contained in:
schneems 2015-02-25 12:58:49 -06:00
parent 71fc789239
commit 6f0a69c589

View file

@ -7,11 +7,9 @@ module RailsGuides
t = str2
n = s.length
m = t.length
max = n/2
return m if (0 == n)
return n if (0 == m)
return n if (n - m).abs > max
d = (0..m).to_a
x = nil