Module: GirFFI::Builder

Extended by:
BuilderHelper
Defined in:
lib/gir_ffi/builder.rb,
lib/gir_ffi/builder/type.rb,
lib/gir_ffi/builder/field.rb,
lib/gir_ffi/builder/property.rb,
lib/gir_ffi/builder/type/base.rb,
lib/gir_ffi/builder/type/enum.rb,
lib/gir_ffi/builder/type/union.rb,
lib/gir_ffi/builder/type/object.rb,
lib/gir_ffi/builder/type/struct.rb,
lib/gir_ffi/builder/type/callback.rb,
lib/gir_ffi/builder/type/constant.rb,
lib/gir_ffi/builder/type/interface.rb,
lib/gir_ffi/builder/type/with_layout.rb,
lib/gir_ffi/builder/type/user_defined.rb,
lib/gir_ffi/builder/type/with_methods.rb,
lib/gir_ffi/builder/type/registered_type.rb,
lib/gir_ffi/builder/type/unintrospectable.rb

Overview

Builds a class based on information found in the introspection repository.

Defined Under Namespace

Modules: Type Classes: Field, Module, Property

Class Method Summary collapse

Methods included from BuilderHelper

const_defined_for, optionally_define_constant

Class Method Details

.attach_ffi_function(lib, info) ⇒ Object

TODO: Move elsewhere, perhaps to Builder::Function.



29
30
31
32
33
34
# File 'lib/gir_ffi/builder.rb', line 29

def self.attach_ffi_function lib, info
  sym = info.symbol
  return if lib.method_defined? sym

  lib.attach_function sym, info.argument_ffi_types, info.return_ffi_type
end

.build_by_gtype(gtype) ⇒ Object



17
18
19
20
21
22
# File 'lib/gir_ffi/builder.rb', line 17

def self.build_by_gtype gtype
  info = GObjectIntrospection::IRepository.default.find_by_gtype gtype
  info ||= UnintrospectableTypeInfo.new gtype

  build_class info
end

.build_class(info) ⇒ Object



13
14
15
# File 'lib/gir_ffi/builder.rb', line 13

def self.build_class info
  Builder::Type.build(info)
end

.build_module(namespace, version = nil) ⇒ Object



24
25
26
# File 'lib/gir_ffi/builder.rb', line 24

def self.build_module namespace, version=nil
  Builder::Module.new(namespace, version).generate
end