Sha256: efcc969827c25555b0e93324d69a81179b8eeadbeb2de3d3753c68a94a6f552b

Contents?: true

Size: 453 Bytes

Versions: 5

Compression:

Stored size: 453 Bytes

Contents

require 'gir_ffi/type_base'

module GirFFI
  module SignalBase
    include TypeBase

    # Create signal handler from a Proc. Makes sure arguments are properly
    # wrapped.
    def from prc
      wrap_in_callback_args_mapper(prc)
    end

    def wrap_in_callback_args_mapper prc
      return if !prc
      return prc if FFI::Function === prc
      return Proc.new do |*args|
        call_with_argument_mapping(prc, *args)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gir_ffi-0.7.4 lib/gir_ffi/signal_base.rb
gir_ffi-0.7.3 lib/gir_ffi/signal_base.rb
gir_ffi-0.7.2 lib/gir_ffi/signal_base.rb
gir_ffi-0.7.1 lib/gir_ffi/signal_base.rb
gir_ffi-0.7.0 lib/gir_ffi/signal_base.rb