# File lib/gir_ffi/callback_base.rb, line 11 def self.store_callback prc CALLBACKS << prc end
Create Callback from a Proc. Makes sure arguments are properly wrapped, and the callback is stored to prevent garbage collection.
# File lib/gir_ffi/callback_base.rb, line 17 def from prc wrap_in_callback_args_mapper(prc).tap do |cb| store_callback cb end end
# File lib/gir_ffi/callback_base.rb, line 7 def store_callback prc CALLBACKS << prc end
# File lib/gir_ffi/callback_base.rb, line 23 def wrap_in_callback_args_mapper prc return prc if FFI::Function === prc return nil if prc.nil? return Proc.new do |*args| call_with_argument_mapping(prc, *args) end end