class FFI::AutoPointer::Releaser

A releaser is an object in charge of release an {AutoPointer}.
All subclasses of Releaser should define a +#release(ptr)+ method.
@abstract Base class for {AutoPointer}‘s releasers.

def autorelease=(autorelease)

Returns:
  • (Boolean) - autorelease

Parameters:
  • autorelease (Boolean) --
def autorelease=(autorelease)
  @autorelease = autorelease if @ptr
end

def call(*args)

Parameters:
  • args () --
def call(*args)
  release(@ptr) if @autorelease && @ptr
end

def free

Returns:
  • (nil) -
def free
  if @ptr
    release(@ptr)
    @autorelease = false
    @ptr = nil
    @proc = nil
  end
end

def initialize(ptr, proc)

Returns:
  • (nil) -

Parameters:
  • proc (#call) --
  • ptr (Pointer) --
def initialize(ptr, proc)
  @ptr = ptr
  @proc = proc
  @autorelease = true
end