Sha256: 8640d07f5ab0fdd97b0e0372ab407f579739af5c419203e47b1fa616bfb0bb05

Contents?: true

Size: 949 Bytes

Versions: 2

Compression:

Stored size: 949 Bytes

Contents

require 'rubygems'

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

module FFI_Yajl
  class Parser
    # 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')
    if defined?(Fiddle)
      ::Fiddle.dlopen(libpath)
    else
      ::DL.dlopen(libpath)
    end
    require 'ffi_yajl/ext/parser'
    include FFI_Yajl::Ext::Parser
  end

  class Encoder
    # 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')
    if defined?(Fiddle)
      ::Fiddle.dlopen(libpath)
    else
      ::DL.dlopen(libpath)
    end
    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.6 lib/ffi_yajl/ext.rb
ffi-yajl-0.1.6-universal-java lib/ffi_yajl/ext.rb