Sha256: febfedf37423f0cea0d82e17e8a99bcd75233598e39ace0dc200006f742e7e80

Contents?: true

Size: 715 Bytes

Versions: 7

Compression:

Stored size: 715 Bytes

Contents

# frozen_string_literal: true

require "gir_ffi/registered_type_base"
require "gir_ffi/method_setup"
require "gir_ffi/instance_method_setup"

module GirFFI
  # Base module for modules representing GLib interfaces.
  module InterfaceBase
    include RegisteredTypeBase
    include MethodSetup
    include InstanceMethodSetup

    def setup_and_call(method, arguments, &block)
      method_name = setup_method method.to_s
      raise NoMethodError, "undefined method `#{method}' for #{self}" unless method_name

      send method_name, *arguments, &block
    end

    def wrap(ptr)
      ptr.to_object
    end

    def to_ffi_type
      :pointer
    end

    def to_callback_ffi_type
      :pointer
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gir_ffi-0.15.6 lib/gir_ffi/interface_base.rb
gir_ffi-0.15.5 lib/gir_ffi/interface_base.rb
gir_ffi-0.15.4 lib/gir_ffi/interface_base.rb
gir_ffi-0.15.3 lib/gir_ffi/interface_base.rb
gir_ffi-0.15.2 lib/gir_ffi/interface_base.rb
gir_ffi-0.15.1 lib/gir_ffi/interface_base.rb
gir_ffi-0.15.0 lib/gir_ffi/interface_base.rb