Module: GirFFI::Core

Included in:
GirFFI
Defined in:
lib/gir_ffi/core.rb

Overview

Core GirFFI interface.

Instance Method Summary collapse

Instance Method Details

#define_type(klass) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/gir_ffi/core.rb', line 31

def define_type(klass)
  unless klass < GirFFI::ObjectBase
    raise ArgumentError, "#{klass} is not a GObject class"
  end

  klass.prepare_user_defined_class
  info = klass.gir_info

  unless info.is_a? UserDefinedObjectInfo
    raise ArgumentError, "#{klass} is not a user-defined class"
  end

  Builders::UserDefinedBuilder.new(info).build_class

  klass.gtype
end

#setup(namespace, version = nil) ⇒ Object



26
27
28
29
# File 'lib/gir_ffi/core.rb', line 26

def setup(namespace, version = nil)
  namespace = namespace.to_s
  Builder.build_module namespace, version
end