Module: Aws::Crt::ManagedNative::ClassMethods

Defined in:
lib/aws-crt/managed_native.rb

Overview

ClassMethods for ManagedNative

Instance Method Summary collapse

Instance Method Details

#native_destroy(destructor) ⇒ Object

Register the method used to cleanup the native object this class manages. Must be a method, use object.method(:method_name).

Example:

native_destroy Aws::Crt::Native.method(:test_release)


70
71
72
73
74
75
76
77
# File 'lib/aws-crt/managed_native.rb', line 70

def native_destroy(destructor)
  unless destructor.is_a?(Method)
    raise ArgumentError,
          'destructor must be a Method. ' \
          'Use object.method(:method_name)'
  end
  @destructor = destructor
end

#on_release(native) ⇒ Object

Do not call directly method passed to FFI Autopointer to call the destructor



81
82
83
# File 'lib/aws-crt/managed_native.rb', line 81

def on_release(native)
  @destructor.call(native)
end