Module: Enumerable

Defined in:
lib/fuzzy_tools/core_ext/enumerable.rb

Instance Method Summary collapse

Instance Method Details

#fuzzy_find(*args) ⇒ Object



4
5
6
7
# File 'lib/fuzzy_tools/core_ext/enumerable.rb', line 4

def fuzzy_find(*args)
  query, options = parse_fuzzy_finder_arguments(args)
  fuzzy_index(options).find(query)
end

#fuzzy_find_all(*args) ⇒ Object



9
10
11
12
# File 'lib/fuzzy_tools/core_ext/enumerable.rb', line 9

def fuzzy_find_all(*args)
  query, options = parse_fuzzy_finder_arguments(args)
  fuzzy_index(options).all(query)
end

#fuzzy_find_all_with_scores(*args) ⇒ Object



14
15
16
17
# File 'lib/fuzzy_tools/core_ext/enumerable.rb', line 14

def fuzzy_find_all_with_scores(*args)
  query, options = parse_fuzzy_finder_arguments(args)
  fuzzy_index(options).all_with_scores(query)
end

#fuzzy_index(options = {}) ⇒ Object



19
20
21
22
# File 'lib/fuzzy_tools/core_ext/enumerable.rb', line 19

def fuzzy_index(options = {})
  options = options.merge(:source => self)
  FuzzyTools::TfIdfIndex.new(options)
end