Module: Rufus::Tokyo::ListMapMixin
Overview
:nodoc:
Instance Method Summary collapse
-
#clib ⇒ Object
A shortcut.
- #outlen_op(method, *args) ⇒ Object
-
#pointer ⇒ Object
Returns the underlying ‘native’ (FFI) memory pointer.
- #pointer_or_raise ⇒ Object
Instance Method Details
#clib ⇒ Object
A shortcut
38 39 40 41 |
# File 'lib/rufus/tokyo/cabinet/util.rb', line 38 def clib CabinetLib end |
#outlen_op(method, *args) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/rufus/tokyo/cabinet/util.rb', line 55 def outlen_op (method, *args) args.unshift(pointer_or_raise) outlen = FFI::MemoryPointer.new(:int) args << outlen out = clib.send(method, *args) return nil if out.address == 0 out.get_bytes(0, outlen.get_int(0)) ensure outlen.free #clib.free(out) # uncommenting that wreaks havoc end |
#pointer ⇒ Object
Returns the underlying ‘native’ (FFI) memory pointer
45 46 47 48 |
# File 'lib/rufus/tokyo/cabinet/util.rb', line 45 def pointer @pointer end |
#pointer_or_raise ⇒ Object
50 51 52 53 |
# File 'lib/rufus/tokyo/cabinet/util.rb', line 50 def pointer_or_raise @pointer || raise("#{self.class} got freed, cannot use anymore") end |