Sha256: abdbdcadf5e9811d107d0aa1a338a0f4c670ef9a9b559746db2f4661fccf0a6a

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

require "gir_ffi/builders/base_type_builder"
require "gir_ffi/builders/marshalling_method_builder"

module GirFFI
  module Builders
    # Implements the creation of a closure class for handling a particular
    # signal. The type will be attached to the appropriate class.
    class SignalClosureBuilder < BaseTypeBuilder
      def setup_class
        setup_constants
        klass.class_eval marshaller_definition, __FILE__, __LINE__
      end

      def setup_method(_method)
        nil
      end

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

        MarshallingMethodBuilder.for_signal(receiver_info,
                                            info).method_definition
      end

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

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

      def container_info
        @container_info ||= info.container
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gir_ffi-0.15.3 lib/gir_ffi/builders/signal_closure_builder.rb
gir_ffi-0.15.2 lib/gir_ffi/builders/signal_closure_builder.rb
gir_ffi-0.15.1 lib/gir_ffi/builders/signal_closure_builder.rb
gir_ffi-0.15.0 lib/gir_ffi/builders/signal_closure_builder.rb