Sha256: 5c7bc330d7c5042be980b24c455ba77e80576ab9ef793398d5970c0a0444a75f

Contents?: true

Size: 957 Bytes

Versions: 3

Compression:

Stored size: 957 Bytes

Contents

# frozen_string_literal: true

require 'gir_ffi/builders/object_builder'
require 'gir_ffi/unintrospectable_signal_info'

module GirFFI
  module Builders
    # Implements the creation of a class representing an object type for
    # which no data is found in the GIR. Typically, these are created to
    # cast objects returned by a function that returns an interface.
    class UnintrospectableBuilder < ObjectBuilder
      def klass
        @klass ||= TypeBuilder::CACHE[target_gtype] ||= Class.new(superclass)
      end

      def setup_class
        setup_constants
        setup_layout
        setup_interfaces
      end

      def setup_instance_method(_method)
        false
      end

      def find_signal(signal_name)
        info = super
        return info if info

        signal_id = GObject.signal_lookup signal_name, target_gtype
        return if signal_id == 0

        UnintrospectableSignalInfo.new(signal_id)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gir_ffi-0.14.1 lib/gir_ffi/builders/unintrospectable_builder.rb
gir_ffi-0.14.0 lib/gir_ffi/builders/unintrospectable_builder.rb
gir_ffi-0.13.1 lib/gir_ffi/builders/unintrospectable_builder.rb