Module: LibKyotoCabinet Private
- Defined in:
- lib/kyotocabinet_ffi/libkyotocabinet_ffi.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
FFI bindings
Constant Summary collapse
- FFI =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Constant holding the FFI module for this ruby engine.
LibKyotoCabinet::load_ffi
- MODES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
mode options
{ :reader => (1 << 0), :writer => (1 << 1), :create => (1 << 2), :truncate => (1 << 3), :auto_transaction => (1 << 4), :auto_synchronize => (1 << 5), :no_file_locking => (1 << 6), :non_blocking_lock => (1 << 7), :no_file_repair => (1 << 8) }
Class Method Summary collapse
-
.find_ffi ⇒ Object
private
Determine FFI constant for this ruby engine.
- .jruby? ⇒ Boolean private
-
.load_ffi ⇒ Object
private
Extend with the correct ffi implementation.
-
.load_libkyotocabinet ⇒ Object
private
Loads the libkyotocabinet shared library.
- .mri? ⇒ Boolean private
- .rubinius? ⇒ Boolean private
Class Method Details
.find_ffi ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Determine FFI constant for this ruby engine.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/kyotocabinet_ffi/libkyotocabinet_ffi.rb', line 21 def find_ffi if defined?(RUBY_ENGINE) && RUBY_ENGINE == "rbx" if const_defined? "::Rubinius::FFI" ::Rubinius::FFI elsif const_defined? "::FFI" ::FFI else require "ffi" ::FFI end else # mri, jruby, etc require "ffi" ::FFI end end |
.jruby? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 |
# File 'lib/kyotocabinet_ffi/libkyotocabinet_ffi.rb', line 11 def jruby? defined?(RUBY_PLATFORM) && ("java" == RUBY_PLATFORM) end |
.load_ffi ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Extend with the correct ffi implementation.
39 40 41 42 43 |
# File 'lib/kyotocabinet_ffi/libkyotocabinet_ffi.rb', line 39 def load_ffi ffi_module = LibKyotoCabinet::find_ffi extend ffi_module::Library ffi_module end |
.load_libkyotocabinet ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Loads the libkyotocabinet shared library.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/kyotocabinet_ffi/libkyotocabinet_ffi.rb', line 47 def load_libkyotocabinet ffi_module = find_ffi extend ffi_module::Library begin ffi_lib "kyotocabinet" rescue LoadError begin ffi_lib "libkyotocabinet.so" rescue LoadError ffi_lib "libkyotocabinet.so.16" end end end |
.mri? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
7 8 9 |
# File 'lib/kyotocabinet_ffi/libkyotocabinet_ffi.rb', line 7 def mri? defined?(RUBY_DESCRIPTION) && (/^ruby/ =~ RUBY_DESCRIPTION) end |
.rubinius? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
15 16 17 |
# File 'lib/kyotocabinet_ffi/libkyotocabinet_ffi.rb', line 15 def rubinius? defined?(RUBY_ENGINE) && ("rbx" == RUBY_ENGINE) end |