lib/fuzzy_match.rb in fuzzy_match-1.2.2 vs lib/fuzzy_match.rb in fuzzy_match-1.3.0
- old
+ new
@@ -18,9 +18,32 @@
require 'fuzzy_match/cached_result'
end
# See the README for more information.
class FuzzyMatch
+ class << self
+ def engine
+ @@engine ||= :pure_ruby
+ end
+
+ def engine=(alt_engine)
+ @@engine = alt_engine
+ end
+
+ def score_class
+ case engine
+ when :pure_ruby
+ Score::PureRuby
+ when :amatch
+ Score::Amatch
+ else
+ raise ::ArgumentError, "[fuzzy_match] #{engine.inspect} is not a recognized engine."
+ end
+ end
+ end
+
+ DEFAULT_ENGINE = :pure_ruby
+
DEFAULT_OPTIONS = {
:first_blocking_decides => false,
:must_match_blocking => false,
:must_match_at_least_one_word => false,
:gather_last_result => false,