module CF::Register

Public Class Methods

included(base) click to toggle source
# File lib/corefoundation/register.rb, line 5
def self.included base
  base.extend self
end

Public Instance Methods

register_type(type_name) click to toggle source
# File lib/corefoundation/register.rb, line 9
def register_type(type_name)
  CF.attach_function "#{type_name}GetTypeID", [], :cftypeid
  type_map[CF.send("#{type_name}GetTypeID")] = self
end

Private Instance Methods

klass_from_cf_type(cftyperef) click to toggle source
# File lib/corefoundation/register.rb, line 16
def klass_from_cf_type(cftyperef)
  klass = type_map[CF.CFGetTypeID(cftyperef)]
  raise TypeError, "No class registered for cf type #{cftyperef.inspect}" unless klass

  klass
end