Sha256: b357e2aac229291d61ac803294ab2de8a687254f69a8c2ada42e1dc63e6ed301

Contents?: true

Size: 757 Bytes

Versions: 3

Compression:

Stored size: 757 Bytes

Contents

require 'gir_ffi/builder/type/base'
module GirFFI
  module Builder
    module Type

      # Implements the creation of a callback type. The type will be
      # attached to the appropriate namespace module, and will be defined
      # as a callback for FFI.
      class Callback < Base
        def instantiate_class
          @klass = optionally_define_constant namespace_module, @classname do
            lib.callback callback_sym, argument_types, return_type
          end
        end

        def callback_sym
          @classname.to_sym
        end

        def argument_types
          Builder.ffi_function_argument_types info
        end

        def return_type
          Builder.ffi_function_return_type info
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gir_ffi-0.5.2 lib/gir_ffi/builder/type/callback.rb
gir_ffi-0.5.1 lib/gir_ffi/builder/type/callback.rb
gir_ffi-0.5.0 lib/gir_ffi/builder/type/callback.rb