I am using the really awesome ruby ffi library to access functions in a c library in ruby.
Is there a way to iterate over the layout of a Ruby FFI::Struct?
example FFI::Struct:
class Example < FFI::Struct
layout :name, string,
:desc, :string,
:type, :int,
:value, :string
end
this doesn't seem to work but something like the below pseudo code:
example_struct.each_key do |key|
puts key
end