lib/picky/extensions/array.rb in picky-1.0.0 vs lib/picky/extensions/array.rb in picky-1.1.0
- old
+ new
@@ -33,9 +33,11 @@
# Will raise if encounters not to_s-able element.
#
def sort_by_levenshtein! from
from = from.to_s
sort! do |this, that|
+ # TODO Cache for speed?
+ #
Text::Levenshtein.distance(this.to_s, from) <=> Text::Levenshtein.distance(that.to_s, from)
end
end
end
\ No newline at end of file