Method: FatCore::String#distance

Defined in:
lib/fat_core/string.rb

#distance(other) ⇒ Integer

Return the Damerau-Levenshtein distance between self an another string using a transposition block size of 1 and quitting if a max distance of 10 is reached.

Parameters:

  • other (#to_s)

    string to compute self's distance from

Returns:

  • (Integer)

    the distance between self and other

[View source]

216
217
218
# File 'lib/fat_core/string.rb', line 216

def distance(other)
  DamerauLevenshtein.distance(self, other.to_s, 1, 10)
end