Class: FFI::Struct::ManagedStructConverter
- Inherits:
-
FFI::StructByReference
- Object
- FFI::StructByReference
- FFI::Struct::ManagedStructConverter
- Defined in:
- lib/ffi/struct.rb
Instance Method Summary collapse
- #from_native(ptr, ctx) ⇒ Struct
-
#initialize(struct_class) ⇒ ManagedStructConverter
constructor
A new instance of ManagedStructConverter.
Methods inherited from FFI::StructByReference
#native_type, #struct_class, #to_native
Constructor Details
#initialize(struct_class) ⇒ ManagedStructConverter
Returns a new instance of ManagedStructConverter.
210 211 212 213 214 215 |
# File 'lib/ffi/struct.rb', line 210 def initialize(struct_class) super(struct_class) raise NoMethodError, "release() not implemented for class #{struct_class}" unless struct_class.respond_to? :release @method = struct_class.method(:release) end |
Instance Method Details
#from_native(ptr, ctx) ⇒ Struct
220 221 222 |
# File 'lib/ffi/struct.rb', line 220 def from_native(ptr, ctx) struct_class.new(AutoPointer.new(ptr, @method)) end |