Class: DB::Postgres::Native::Strings
- Inherits:
-
Object
- Object
- DB::Postgres::Native::Strings
- Defined in:
- lib/db/postgres/native/connection.rb
Overview
Helper class for managing FFI string arrays.
Instance Attribute Summary collapse
-
#array ⇒ Object
readonly
Returns the value of attribute array.
- #The FFI array pointer.(FFIarraypointer.) ⇒ Object readonly
Instance Method Summary collapse
-
#initialize(values) ⇒ Strings
constructor
Initialize a string array for FFI.
Constructor Details
#initialize(values) ⇒ Strings
Initialize a string array for FFI.
17 18 19 20 21 22 23 |
# File 'lib/db/postgres/native/connection.rb', line 17 def initialize(values) @array = FFI::MemoryPointer.new(:pointer, values.size + 1) @pointers = values.map do |value| FFI::MemoryPointer.from_string(value.to_s) end @array.write_array_of_pointer(@pointers) end |
Instance Attribute Details
#array ⇒ Object (readonly)
Returns the value of attribute array.
26 27 28 |
# File 'lib/db/postgres/native/connection.rb', line 26 def array @array end |
#The FFI array pointer.(FFIarraypointer.) ⇒ Object (readonly)
26 |
# File 'lib/db/postgres/native/connection.rb', line 26 attr :array |