Class: GirFFI::UnintrospectableTypeInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/gir_ffi/unintrospectable_type_info.rb

Overview

Represents a type not found in the GIR, conforming, as needed, to the interface of GObjectIntrospection::IObjectInfo.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gtype, gir = GObjectIntrospection::IRepository.default, gobject = GObject) ⇒ UnintrospectableTypeInfo

Returns a new instance of UnintrospectableTypeInfo.



10
11
12
13
14
15
16
# File 'lib/gir_ffi/unintrospectable_type_info.rb', line 10

def initialize(gtype,
               gir = GObjectIntrospection::IRepository.default,
               gobject = GObject)
  @g_type = gtype
  @gir = gir
  @gobject = gobject
end

Instance Attribute Details

#g_typeObject (readonly)

Returns the value of attribute g_type.



8
9
10
# File 'lib/gir_ffi/unintrospectable_type_info.rb', line 8

def g_type
  @g_type
end

Instance Method Details

#class_structObject

TODO: Create custom class that includes the interfaces instead



53
54
55
# File 'lib/gir_ffi/unintrospectable_type_info.rb', line 53

def class_struct
  parent.class_struct
end

#fieldsObject



44
45
46
# File 'lib/gir_ffi/unintrospectable_type_info.rb', line 44

def fields
  []
end

#find_signal(_any) ⇒ Object



48
49
50
# File 'lib/gir_ffi/unintrospectable_type_info.rb', line 48

def find_signal(_any)
  nil
end

#info_typeObject



18
19
20
# File 'lib/gir_ffi/unintrospectable_type_info.rb', line 18

def info_type
  :unintrospectable
end

#interfacesObject



38
39
40
41
42
# File 'lib/gir_ffi/unintrospectable_type_info.rb', line 38

def interfaces
  @gobject.type_interfaces(@g_type).map do |gtype|
    @gir.find_by_gtype gtype
  end.compact
end

#namespaceObject



34
35
36
# File 'lib/gir_ffi/unintrospectable_type_info.rb', line 34

def namespace
  parent.namespace
end

#parentObject



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

def parent
  @gir.find_by_gtype(parent_gtype) || self.class.new(parent_gtype, @gir, @gobject)
end

#parent_gtypeObject



30
31
32
# File 'lib/gir_ffi/unintrospectable_type_info.rb', line 30

def parent_gtype
  @parent_gtype ||= @gobject.type_parent @g_type
end

#safe_nameObject



22
23
24
# File 'lib/gir_ffi/unintrospectable_type_info.rb', line 22

def safe_name
  @gobject.type_name @g_type
end