Class: GObjectIntrospection::Loader

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/gobject-introspection/loader.rb,
ext/gobject-introspection/rb-gi-loader.c

Defined Under Namespace

Classes: Invoker

Constant Summary collapse

UNKNOWN_OFFSET =
INT2NUM(0xFFFF)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_module) ⇒ Loader

Returns a new instance of Loader.



30
31
32
33
# File 'lib/gobject-introspection/loader.rb', line 30

def initialize(base_module)
  @base_module = base_module
  @version = nil
end

Instance Attribute Details

#versionObject

Returns the value of attribute version.



29
30
31
# File 'lib/gobject-introspection/loader.rb', line 29

def version
  @version
end

Class Method Details

.load(namespace, base_module, options = {}) ⇒ Object



22
23
24
25
26
# File 'lib/gobject-introspection/loader.rb', line 22

def load(namespace, base_module, options={})
  loader = new(base_module)
  loader.version = options[:version]
  loader.load(namespace)
end

Instance Method Details

#load(namespace) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/gobject-introspection/loader.rb', line 35

def load(namespace)
  repository = Repository.default
  repository.require(namespace, @version)
  pre_load(repository, namespace)
  repository.each(namespace) do |info|
    load_info(info) if info.is_a?(InterfaceInfo)
  end
  repository.each(namespace) do |info|
    load_info(info) unless info.is_a?(InterfaceInfo)
  end
  post_load(repository, namespace)
end