module Spotify::BestEffortString

A regular string type, ending at the first NULL byte.

Regular FFI :string raises errors when it encounters NULLs.

Public Class Methods

to_native(value, ctx) click to toggle source

Extracts all of the string up until the first NULL byte.

@param [String, nil] value @param ctx @return [String] value, up until the first NULL byte

# File lib/spotify/data_converters/best_effort_string.rb, line 16
def to_native(value, ctx)
  value && value.dup.force_encoding(Encoding::BINARY)[/[^\x00]*/n]
end