class FFI::Enum
def to_native(val, ctx)
-
(Integer)
- value of a enum symbol
Parameters:
-
ctx
() -- unused
-
val
(Symbol, Integer, #to_int
) --
def to_native(val, ctx) @kv_map[val] || if val.is_a?(Integer) val elsif val.respond_to?(:to_int) val.to_int else raise ArgumentError, "invalid enum value, #{val.inspect}" end end