summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2015-04-13 15:51:18 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2015-04-13 15:51:18 -0700
commitf3ce7d4eef7c52de57cd81ec05bc4c245230f26c (patch)
treebdec483cd0df3c42f7377bebd62d6de4962181ef /lib
parentb44198945b41462fd7663ea2b7a9b7362ad32083 (diff)
downloadffi-yajl-f3ce7d4eef7c52de57cd81ec05bc4c245230f26c.tar.gz
limit rescue to just LoadError
Diffstat (limited to 'lib')
-rw-r--r--lib/ffi_yajl/map_library_name.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/ffi_yajl/map_library_name.rb b/lib/ffi_yajl/map_library_name.rb
index 13168b6..8723424 100644
--- a/lib/ffi_yajl/map_library_name.rb
+++ b/lib/ffi_yajl/map_library_name.rb
@@ -30,13 +30,23 @@ require 'libyajl2'
module FFI_Yajl
module MapLibraryName
+ private
+
+ # Stub for tests to override the host_os
+ #
+ # @api private
+ # @return Array<String> lower case ruby host_os string
+ def host_os
+ RbConfig::CONFIG['host_os'].downcase
+ end
+
# Array of yajl library names on the platform. Some platforms like Windows
# and Mac may have different names/extensions.
#
# @api private
# @return Array<String> Array of yajl library names for platform
def library_names
- case RbConfig::CONFIG['host_os'].downcase
+ case host_os
when /mingw|mswin/
[ "libyajl.so", "yajl.dll" ]
when /cygwin/
@@ -91,7 +101,7 @@ module FFI_Yajl
begin
ffi_lib libname
found = true
- rescue
+ rescue LoadError
end
end
ffi_lib 'yajl' unless found