Sha256: 88efe7492ceefdb17ad9650d8308348389792ce53b93302326260684a6c518a0

Contents?: true

Size: 603 Bytes

Versions: 2

Compression:

Stored size: 603 Bytes

Contents

# frozen_string_literal: true
module GirFFI
  module Builders
    # Builder that generates code to convert closure arguments ('user data')
    # from Ruby to C. Used by argument builders.
    class ClosureToPointerConvertor
      def initialize(argument_name, callback_argument)
        @argument_name = argument_name
        @callback_argument = callback_argument
      end

      def conversion
        "GirFFI::InPointer.from_closure_data(#{callback_argument_name})"
      end

      private

      def callback_argument_name
        @callback_argument.call_argument_name
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gir_ffi-0.9.5 lib/gir_ffi/builders/closure_to_pointer_convertor.rb
gir_ffi-0.9.4 lib/gir_ffi/builders/closure_to_pointer_convertor.rb