Class: GirFFI::Builders::SignalClosureBuilder

Inherits:
GirFFI::BaseTypeBuilder show all
Defined in:
lib/gir_ffi/builders/signal_closure_builder.rb

Overview

Implements the creation of a closure class for handling a particular signal. The type will be attached to the appropriate class.

Instance Attribute Summary

Attributes inherited from GirFFI::BaseTypeBuilder

#info

Instance Method Summary collapse

Methods inherited from GirFFI::BaseTypeBuilder

#build_class, #initialize

Methods included from GirFFI::BuilderHelper

#get_or_define_class, #get_or_define_module, #optionally_define_constant

Constructor Details

This class inherits a constructor from GirFFI::BaseTypeBuilder

Instance Method Details

#container_classObject



37
38
39
# File 'lib/gir_ffi/builders/signal_closure_builder.rb', line 37

def container_class
  @container_class ||= Builder.build_class(container_info)
end

#container_infoObject



41
42
43
# File 'lib/gir_ffi/builders/signal_closure_builder.rb', line 41

def container_info
  @container_info ||= info.container
end

#instantiate_classObject



9
10
11
12
13
14
15
# File 'lib/gir_ffi/builders/signal_closure_builder.rb', line 9

def instantiate_class
  unless already_set_up
    setup_constants
    klass.class_eval marshaller_definition
  end
  klass
end

#klassObject



33
34
35
# File 'lib/gir_ffi/builders/signal_closure_builder.rb', line 33

def klass
  @klass ||= get_or_define_class container_class, @classname, GObject::RubyClosure
end

#marshaller_definitionObject



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/gir_ffi/builders/signal_closure_builder.rb', line 21

def marshaller_definition
  arg_infos = info.args

  container_type_info = ReceiverTypeInfo.new(container_info)
  receiver_info = ReceiverArgumentInfo.new(container_type_info)
  return_value_info = ReturnValueInfo.new info.return_type

  MarshallingMethodBuilder.for_signal(receiver_info,
                                      arg_infos,
                                      return_value_info).method_definition
end

#setup_method(_method) ⇒ Object



17
18
19
# File 'lib/gir_ffi/builders/signal_closure_builder.rb', line 17

def setup_method _method
  nil
end