Sha256: 086e1a241204d04d3a684efd15f8ec315a0bda30ba9860bfffb69fba05596e53

Contents?: true

Size: 355 Bytes

Versions: 2

Compression:

Stored size: 355 Bytes

Contents

# frozen_string_literal: true

require 'ffi'

# Re-open the FFI::Pointer class to add a custom method.
class FFI::Pointer
  def read_array_of_string
    elements = []

    loc = self

    until (element = loc.read_pointer).null?
      elements << element.read_string
      loc += FFI::Type::POINTER.size
    end

    elements
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sys-admin-1.8.3-universal-mingw32 lib/sys/admin/custom.rb
sys-admin-1.8.2-universal-mingw32 lib/sys/admin/custom.rb