def implement(implementor_gtype, name)
info = @infos[name]
return false if info.nil?
container = info.container
vtable_gtype = container.gtype
if container.respond_to?(:class_struct)
struct = container.class_struct
parent_gtype = implementor_gtype.parent
parent_class = parent_gtype.to_class
invoker = Invoker.new(info, name, "#{parent_class.name}\##{name}")
parent_vfunc_callable = Module.new
parent_vfunc_callable.define_method(name) do |*args, &block|
invoker.invoke(self, args, block, implementor_gtype: parent_gtype)
end
Module.method(:include).unbind.bind_call(implementor_gtype.to_class,
parent_vfunc_callable)
else
return false unless implementor_gtype.type_is_a?(vtable_gtype)
struct = container.iface_struct
end
field = struct.find_field(info.name)
@loader_class.implement_virtual_function(field,
implementor_gtype,
vtable_gtype,
name.to_s)
true
end