module Spotify::ByteString
ByteStrings are for strings that store any binary data, not just regular NULL-terminated strings. It is used for the Spotify
application key.
Public Class Methods
reference_required?()
click to toggle source
@see NulString.reference_required?
# File lib/spotify/data_converters/byte_string.rb, line 26 def reference_required? true end
to_native(value, ctx)
click to toggle source
Given either a String or nil, make an actual FFI::Pointer of that value, without an ending NULL-byte.
@param [#to_str, nil] value @param ctx @return [FFI::Pointer]
# File lib/spotify/data_converters/byte_string.rb, line 16 def to_native(value, ctx) value && begin value = value.to_str pointer = FFI::MemoryPointer.new(:char, value.bytesize) pointer.write_string(value) end end