summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authortduehr <tduehr@gmail.com>2015-05-26 08:26:25 -0500
committertduehr <tduehr@gmail.com>2015-05-26 08:26:59 -0500
commit83c53aa8d51a24f6f7e2f866eeb1649484f57a22 (patch)
tree08ac15cd56170d4016bf3c9ea9c0ccc13169f240 /lib
parent4c64e84418c2f268b4967dc8c3f03876e1bfa88e (diff)
downloadffi-83c53aa8d51a24f6f7e2f866eeb1649484f57a22.tar.gz
fix library load... forever
thanks @davispuh
Diffstat (limited to 'lib')
-rw-r--r--lib/ffi.rb14
1 files changed, 1 insertions, 13 deletions
diff --git a/lib/ffi.rb b/lib/ffi.rb
index 56aa9f2..361e53d 100644
--- a/lib/ffi.rb
+++ b/lib/ffi.rb
@@ -1,19 +1,7 @@
if !defined?(RUBY_ENGINE) || RUBY_ENGINE == 'ruby' || RUBY_ENGINE == 'rbx'
Object.send(:remove_const, :FFI) if defined?(::FFI)
begin
- if RUBY_VERSION =~ /^1\.8/
- require '1.8/ffi_c'
- elsif RUBY_VERSION =~ /^1\.9/
- require '1.9/ffi_c'
- elsif RUBY_VERSION =~ /^2\.0/
- require '2.0/ffi_c'
- elsif RUBY_VERSION =~ /^2\.1/
- require '2.1/ffi_c'
- elsif RUBY_VERSION =~ /^2\.2/
- require '2.2/ffi_c'
- else
- require 'ffi_c'
- end
+ require RUBY_VERSION.split('.')[0, 2].join('.') + '/ffi_c'
rescue Exception
require 'ffi_c'
end