summaryrefslogtreecommitdiff
path: root/lib/ffi_yajl/ext.rb
blob: 12f74d9fb4f5a14783c992b84d5ac613cc6509fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
require 'rubygems'

require 'ffi_yajl/encoder'
require 'ffi_yajl/parser'
require 'libyajl2'
require 'ffi_yajl/map_library_name'
require 'ffi_yajl/ext/dlopen'

module FFI_Yajl
  extend FFI_Yajl::MapLibraryName

  extend FFI_Yajl::Ext::Dlopen

  libname = map_library_name
  libpath = File.expand_path(File.join(Libyajl2.opt_path, libname))

  dlopen(libpath)

  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