Class: FFI::Struct::ManagedStructConverter
- Inherits:
-
FFI::StructByReference
- Object
- FFI::StructByReference
- FFI::Struct::ManagedStructConverter
- Defined in:
- lib/ffi/struct.rb
Instance Attribute Summary
Attributes inherited from FFI::StructByReference
Instance Method Summary collapse
- #from_native(ptr, ctx) ⇒ Struct
-
#initialize(struct_class) ⇒ ManagedStructConverter
constructor
A new instance of ManagedStructConverter.
Methods inherited from FFI::StructByReference
Methods included from DataConverter
Constructor Details
#initialize(struct_class) ⇒ ManagedStructConverter
Returns a new instance of ManagedStructConverter.
150 151 152 153 154 155 |
# File 'lib/ffi/struct.rb', line 150 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
160 161 162 |
# File 'lib/ffi/struct.rb', line 160 def from_native(ptr, ctx) struct_class.new(AutoPointer.new(ptr, @method)) end |