summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2015-07-09 13:35:57 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2015-07-09 13:35:57 -0700
commit79921599e7ba0f150f4cd093d626eea49831d8dc (patch)
treec18acfc3c9975b9a9bbf1029f7c6f39814bdf6d8 /lib
parentd6e5fa74de5b13abc6c60a95b83acc8eb8d3ed05 (diff)
downloadffi-yajl-79921599e7ba0f150f4cd093d626eea49831d8dc.tar.gz
eliminate Rescue Exception
Diffstat (limited to 'lib')
-rw-r--r--lib/ffi_yajl/benchmark/encode.rb20
-rw-r--r--lib/ffi_yajl/benchmark/encode_profile.rb2
-rw-r--r--lib/ffi_yajl/benchmark/parse.rb12
-rw-r--r--lib/ffi_yajl/benchmark/parse_profile.rb2
-rw-r--r--lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb2
5 files changed, 15 insertions, 23 deletions
diff --git a/lib/ffi_yajl/benchmark/encode.rb b/lib/ffi_yajl/benchmark/encode.rb
index eda4fe7..0a33a53 100644
--- a/lib/ffi_yajl/benchmark/encode.rb
+++ b/lib/ffi_yajl/benchmark/encode.rb
@@ -5,14 +5,10 @@ require 'rubygems'
require 'benchmark'
require 'stringio'
if !defined?(RUBY_ENGINE) || RUBY_ENGINE !~ /jruby/
- if ENV['FORCE_FFI_YAJL'] != 'ext'
- begin
- require 'yajl'
- rescue Exception
- puts "INFO: yajl-ruby not installed"
- end
- else
- puts "INFO: skipping yajl-ruby because we're using the C extension"
+ begin
+ require 'yajl'
+ rescue LoadError
+ puts "INFO: yajl-ruby not installed"
end
else
puts "INFO: skipping yajl-ruby on jruby"
@@ -20,22 +16,22 @@ end
require 'ffi_yajl'
begin
require 'json'
-rescue Exception
+rescue LoadError
puts "INFO: json gem not installed"
end
begin
require 'psych'
-rescue Exception
+rescue LoadError
puts "INFO: psych gem not installed"
end
begin
require 'active_support'
-rescue Exception
+rescue LoadError
puts "INFO: active_support gem not installed"
end
begin
require 'oj'
-rescue Exception
+rescue LoadError
puts "INFO: oj gem not installed"
end
diff --git a/lib/ffi_yajl/benchmark/encode_profile.rb b/lib/ffi_yajl/benchmark/encode_profile.rb
index f7ac7c2..d993581 100644
--- a/lib/ffi_yajl/benchmark/encode_profile.rb
+++ b/lib/ffi_yajl/benchmark/encode_profile.rb
@@ -5,7 +5,7 @@ require 'rubygems'
require 'ffi_yajl'
begin
require 'perftools'
-rescue Exception
+rescue LoadError
puts "INFO: perftools.rb gem not installed"
end
diff --git a/lib/ffi_yajl/benchmark/parse.rb b/lib/ffi_yajl/benchmark/parse.rb
index 7e1f3a6..0625e33 100644
--- a/lib/ffi_yajl/benchmark/parse.rb
+++ b/lib/ffi_yajl/benchmark/parse.rb
@@ -4,14 +4,10 @@ require 'yaml'
require 'yajl'
require 'ffi_yajl'
if !defined?(RUBY_ENGINE) || RUBY_ENGINE !~ /jruby/
- if ENV['FORCE_FFI_YAJL'] != 'ext'
- begin
- require 'yajl'
- rescue Exception
- puts "INFO: yajl-ruby not installed"
- end
- else
- puts "INFO: skipping yajl-ruby because we're using the C extension"
+ begin
+ require 'yajl'
+ rescue LoadError
+ puts "INFO: yajl-ruby not installed"
end
else
puts "INFO: skipping yajl-ruby on jruby"
diff --git a/lib/ffi_yajl/benchmark/parse_profile.rb b/lib/ffi_yajl/benchmark/parse_profile.rb
index 39343bc..dfcbc01 100644
--- a/lib/ffi_yajl/benchmark/parse_profile.rb
+++ b/lib/ffi_yajl/benchmark/parse_profile.rb
@@ -5,7 +5,7 @@ require 'rubygems'
require 'ffi_yajl'
begin
require 'perftools'
-rescue Exception
+rescue LoadError
puts "INFO: perftools.rb gem not installed"
end
diff --git a/lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb b/lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb
index 8d9dd5d..db72e45 100644
--- a/lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb
+++ b/lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb
@@ -10,7 +10,7 @@ module FFI_Yajl
def run
begin
require 'ruby-prof'
- rescue Exception
+ rescue LoadError
puts "INFO: perftools.rb gem not installed"
end