artist versions: fix uninitialized constant error.

Error appears intermittently depending on module load order.
This commit is contained in:
evazion
2019-08-13 21:30:20 -05:00
parent 0a5e04f015
commit ca2e2c92b9
3 changed files with 4 additions and 1 deletions

View File

@@ -27,7 +27,7 @@ class SetDiff
end
def find_similar(string, candidates, max_dissimilarity: 0.70)
distance = ->(other) { DidYouMean::Levenshtein.distance(string, other) }
distance = ->(other) { ::DidYouMean::Levenshtein.distance(string, other) }
max_distance = string.size * max_dissimilarity
candidates.select { |candidate| distance[candidate] <= max_distance }.sort_by(&distance).first