Class: CF::Base::Releaser

Inherits:
Object
  • Object
show all
Defined in:
lib/corefoundation/base.rb

Instance Method Summary collapse

Constructor Details

#initialize(ptr) ⇒ Releaser

Returns a new instance of Releaser.



49
50
51
# File 'lib/corefoundation/base.rb', line 49

def initialize(ptr)
  @address  = ptr.address
end

Instance Method Details

#call(*ignored) ⇒ Object



53
54
55
56
57
58
# File 'lib/corefoundation/base.rb', line 53

def call *ignored
  if @address != 0
    CF.release(FFI::Pointer.new(:pointer, @address))
    @address = 0
  end
end