Class: Spoon::PointerArray
- Inherits:
-
Object
- Object
- Spoon::PointerArray
- Defined in:
- lib/spoon/unix.rb
Instance Method Summary collapse
- #<<(ptr) ⇒ Object
-
#initialize ⇒ PointerArray
constructor
A new instance of PointerArray.
- #pointer ⇒ Object
Constructor Details
#initialize ⇒ PointerArray
Returns a new instance of PointerArray.
106 107 108 |
# File 'lib/spoon/unix.rb', line 106 def initialize @ary = [] end |
Instance Method Details
#<<(ptr) ⇒ Object
110 111 112 113 |
# File 'lib/spoon/unix.rb', line 110 def <<(ptr) @ary << ptr self end |
#pointer ⇒ Object
115 116 117 118 119 120 121 122 |
# File 'lib/spoon/unix.rb', line 115 def pointer if @pointer.nil? || (@pointer.size / @pointer.type_size) <= @ary.length ptr = FFI::MemoryPointer.new(:pointer, @ary.length + 1) ptr.put_array_of_pointer(0, @ary) @pointer = ptr end @pointer end |