Sha256: a35d0f554514dbdd6d36ef33c28fc721b13cf0a5db79940327e02f9eae4d5626

Contents?: true

Size: 840 Bytes

Versions: 2

Compression:

Stored size: 840 Bytes

Contents

require 'rubygems'

require 'ffi_yajl/encoder'
require 'ffi_yajl/parser'
require 'ffi'
require 'libyajl2'
begin
  require 'fiddle'
rescue LoadError
end
begin
  require 'dl'
rescue LoadError
end

module FFI_Yajl
  # FIXME: DRY with ffi_yajl/ffi.rb
  libname = ::FFI.map_library_name("yajl")
  libpath = File.expand_path(File.join(Libyajl2.opt_path, libname))
  libpath.gsub!(/dylib/, 'bundle')
  libpath = ::FFI.map_library_name("yajl") unless File.exist?(libpath)
  if defined?(Fiddle) && Fiddle.respond_to?(:dlopen)
    ::Fiddle.dlopen(libpath)
  elsif defined?(DL) && DL.respond_to?(:dlopen)
    ::DL.dlopen(libpath)
  else
    ffi_lib libpath
  end

  class Parser
    require 'ffi_yajl/ext/parser'
    include FFI_Yajl::Ext::Parser
  end

  class Encoder
    require 'ffi_yajl/ext/encoder'
    include FFI_Yajl::Ext::Encoder
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ffi-yajl-0.1.7 lib/ffi_yajl/ext.rb
ffi-yajl-0.1.7-universal-java lib/ffi_yajl/ext.rb