Class: FuzzyStringMatch::JaroWinkler
- Inherits:
-
Object
- Object
- FuzzyStringMatch::JaroWinkler
- Defined in:
- lib/fuzzystringmatch.rb
Class Method Summary collapse
-
.create(type = :pure) ⇒ Object
factory method.
Class Method Details
.create(type = :pure) ⇒ Object
factory method
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/fuzzystringmatch.rb', line 22 def self.create( type = :pure ) # factory method case type when :pure FuzzyStringMatch::JaroWinklerPure.new when :native if RUBY_PLATFORM == "java" STDERR.puts "fuzzy-string-match Warning: native version is disabled on java platform. falled back to pure ruby version..." FuzzyStringMatch::JaroWinklerPure.new else begin require 'fuzzystringmatch/inline' begin FuzzyStringMatch::JaroWinklerInline.new rescue NameError STDERR.puts "fuzzy-string-match Warning: native version is disabled. falled back to pure ruby version..." FuzzyStringMatch::JaroWinklerPure.new end rescue CompilationError STDERR.puts "fuzzy-string-match Warning: fallback into pure version, because compile failed." FuzzyStringMatch::JaroWinklerPure.new end end end end |