From 4168ef3dbd56a7b52978efb2ff7d0dc448f8f8f1 Mon Sep 17 00:00:00 2001 From: Anthony Bargnesi Date: Mon, 16 Mar 2015 13:05:57 -0400 Subject: Anchor ruby version patterns to start of line This is necessary to differentiate between 2.1.x and 2.2.1 ruby version patterns. The pattern is also more accurately reflects the intention. refs #419 --- lib/ffi.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/ffi.rb b/lib/ffi.rb index 5e02a5c..56aa9f2 100644 --- a/lib/ffi.rb +++ b/lib/ffi.rb @@ -1,15 +1,15 @@ if !defined?(RUBY_ENGINE) || RUBY_ENGINE == 'ruby' || RUBY_ENGINE == 'rbx' Object.send(:remove_const, :FFI) if defined?(::FFI) begin - if RUBY_VERSION =~ /1\.8/ + if RUBY_VERSION =~ /^1\.8/ require '1.8/ffi_c' - elsif RUBY_VERSION =~ /1\.9/ + elsif RUBY_VERSION =~ /^1\.9/ require '1.9/ffi_c' - elsif RUBY_VERSION =~ /2\.0/ + elsif RUBY_VERSION =~ /^2\.0/ require '2.0/ffi_c' - elsif RUBY_VERSION =~ /2\.1/ + elsif RUBY_VERSION =~ /^2\.1/ require '2.1/ffi_c' - elsif RUBY_VERSION =~ /2\.2/ + elsif RUBY_VERSION =~ /^2\.2/ require '2.2/ffi_c' else require 'ffi_c' -- cgit v1.2.1