Module: CF::Memory

Included in:
Base
Defined in:
lib/corefoundation/memory.rb

Overview

Provides a more declarative way to define all required abstract methods. This gets included in the CF::Base class whose subclasses then need to define those methods.

Instance Method Summary collapse

Instance Method Details

#inspectString

Returns a ruby string containing the output of CFCopyDescription for the wrapped object

Returns:



20
21
22
# File 'lib/corefoundation/memory.rb', line 20

def inspect
  CF::String.new(CF.CFCopyDescription(self)).to_s
end

#releaseObject

Calls CFRelease on the wrapped pointer

Returns:

  • Returns self



27
28
29
30
# File 'lib/corefoundation/memory.rb', line 27

def release
  CF.release(self)
  self
end

#retainObject

Calls CFRetain on the wrapped pointer

Returns:

  • Returns self



35
36
37
38
# File 'lib/corefoundation/memory.rb', line 35

def retain
  CF.retain(self)
  self
end

#to_ptrFFI::Pointer

Returns the wrapped pointer

Returns:

  • (FFI::Pointer)


43
44
45
# File 'lib/corefoundation/memory.rb', line 43

def to_ptr
  ptr
end