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.
110 111 112 |
# File 'lib/spoon/unix.rb', line 110 def initialize @ary = [] end |
Instance Method Details
#<<(ptr) ⇒ Object
114 115 116 117 |
# File 'lib/spoon/unix.rb', line 114 def <<(ptr) @ary << ptr self end |
#pointer ⇒ Object
119 120 121 122 123 124 125 126 |
# File 'lib/spoon/unix.rb', line 119 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 |