Method: Spotify::UTF8StringPointer.from_native

Defined in:
lib/spotify/data_converters/utf8_string_pointer.rb

.from_native(value, ctx) ⇒ String?

Given a pointer, read out it’s string.

Parameters:

  • value (FFI::Pointer)
  • ctx

Returns:

  • (String, nil)


27
28
29
# File 'lib/spotify/data_converters/utf8_string_pointer.rb', line 27

def from_native(value, ctx)
  value.read_string.force_encoding(Encoding::UTF_8) unless value.null?
end