diff options
Diffstat (limited to 'lib/ffi_yajl/encoder.rb')
-rw-r--r-- | lib/ffi_yajl/encoder.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/ffi_yajl/encoder.rb b/lib/ffi_yajl/encoder.rb index d720187..ea6c1d7 100644 --- a/lib/ffi_yajl/encoder.rb +++ b/lib/ffi_yajl/encoder.rb @@ -48,18 +48,22 @@ module FFI_Yajl end end - if ENV['FORCE_FFI_YAJL'] == "ffi" || defined?(Yajl) + if ENV['FORCE_FFI_YAJL'] == "ext" + require 'ffi_yajl/ext/encoder' + include FFI_Yajl::Ext::Encoder + elsif ENV['FORCE_FFI_YAJL'] == "ffi" || defined?(Yajl) # on Linux yajl-ruby and non-FFI ffi_yajl conflict - require 'ffi_yajl/ffi' + require 'ffi_yajl/ffi/encoder' include FFI_Yajl::FFI::Encoder else begin - require 'ffi_yajl/ext' + require 'ffi_yajl/ext/encoder' include FFI_Yajl::Ext::Encoder rescue LoadError - require 'ffi_yajl/ffi' + require 'ffi_yajl/ffi/encoder' include FFI_Yajl::FFI::Encoder end end + end end |