Subject:
[ruby-ffi] Re: What is the context parameter when defining a custom type with DataConverter?
From:
Wayne Meissner
Date:
6/3/12 5:21 PM
To:
ruby-ffi@googlegroups.com


Currently it is unused.  The intention was to provide more information to converters about the context within which the converter was called (e.g. was it a method parameter, callback parameter, return, struct field assignment, etc).  But, that never got implemented.

On Monday, June 4, 2012 7:35:18 AM UTC+10, Kim Burgestrand wrote:
Looking at an old issue (https://github.com/ffi/ffi/issues/114#issuecomment-1246483) where a custom Bool type is defined, .to_native and .from_native both accept a second “ctx” parameter. What is this? How should it be used, if at all?

The reason I ask is that I’ve written my own converter for making sure input and output strings are always in UTF-8 encoding, and I’d like to do it properly: https://github.com/Burgestrand/libspotify-ruby/blob/35c32461d757649297e3592b80b4937e35e3a1f8/lib/spotify/utf8_string.rb