Class: GirFFI::Builders::SignalBuilder

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

Overview

Implements the creation of a signal module 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



42
43
44
# File 'lib/gir_ffi/builders/signal_builder.rb', line 42

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

#container_infoObject



46
47
48
# File 'lib/gir_ffi/builders/signal_builder.rb', line 46

def container_info
  @container_info ||= info.container
end

#instantiate_classObject



14
15
16
17
18
19
20
21
# File 'lib/gir_ffi/builders/signal_builder.rb', line 14

def instantiate_class
  unless already_set_up
    klass.extend SignalBase
    setup_constants
    klass.class_eval mapping_method_definition
  end
  klass
end

#klassObject



23
24
25
# File 'lib/gir_ffi/builders/signal_builder.rb', line 23

def klass
  @klass ||= get_or_define_module container_class, @classname
end

#mapping_method_definitionObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/gir_ffi/builders/signal_builder.rb', line 27

def mapping_method_definition
  arg_infos = info.args

  container_type_info = ReceiverTypeInfo.new(container_info)
  receiver_info = ReceiverArgumentInfo.new(container_type_info)

  user_data_type_info = UserDataTypeInfo.new
  user_data_argument_info = UserDataArgumentInfo.new(user_data_type_info)

  MappingMethodBuilder.for_signal(receiver_info,
                                  arg_infos,
                                  user_data_argument_info,
                                  info.return_type).method_definition
end