Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed ffi_lib loading on Ubuntu/Linux.

  • Loading branch information...
commit f1d4a5f2f57c837c60b2b92b4e859824da4d3854 1 parent c575e32
@dbalatero authored
Showing with 5 additions and 6 deletions.
  1. +1 −0  .gitignore
  2. +4 −6 lib/levenshtein.rb
View
1  .gitignore
@@ -1,3 +1,4 @@
README.markdown.html
*.rbc
pkg
+.*.sw?
View
10 lib/levenshtein.rb
@@ -3,12 +3,10 @@
module Levenshtein
extend FFI::Library
+ # Try loading in order.
library = File.dirname(__FILE__) + "/../ext/levenshtein/levenshtein"
- begin
- ffi_lib(library)
- rescue LoadError
- ffi_lib(library + ".bundle")
- end
-
+ candidates = ['.bundle', '.so', '.dylib', ''].map { |ext| library + ext }
+ ffi_lib(candidates)
+
attach_function :distance, :levenshtein, [:string, :string], :int
end
Please sign in to comment.
Something went wrong with that request. Please try again.