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:
parent
71fc789239
commit
6f0a69c589
1 changed files with 0 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue