Class: GObject::Closure
- Inherits:
-
Object
- Object
- GObject::Closure
- Defined in:
- lib/ffi-gobject/closure.rb
Overview
Overrides for GClosure, GObject’s base class for closure objects.
To create Closure objects wrapping Ruby code, use RubyClosure.
Direct Known Subclasses
Instance Method Summary collapse
-
#invoke(return_value, param_values) ⇒ Object
This override of invoke ensures the return value location can be passed in as the first argument, which is needed to ensure the GValue is initialized with the proper type.
- #set_marshal(marshal) ⇒ Object
- #store_pointer(ptr) ⇒ Object
Instance Method Details
#invoke(return_value, param_values) ⇒ Object
This override of invoke ensures the return value location can be passed in as the first argument, which is needed to ensure the GValue is initialized with the proper type.
30 31 32 33 34 35 36 |
# File 'lib/ffi-gobject/closure.rb', line 30 def invoke(return_value, param_values) rval = Value.from(return_value) n_params = param_values.length params = GirFFI::SizedArray.from(Value, -1, param_values) Lib.g_closure_invoke self, rval, n_params, params, nil rval.get_value end |
#set_marshal(marshal) ⇒ Object
16 17 18 19 |
# File 'lib/ffi-gobject/closure.rb', line 16 def set_marshal(marshal) callback = ClosureMarshal.from marshal Lib.g_closure_set_marshal self, callback end |
#store_pointer(ptr) ⇒ Object
38 39 40 41 42 43 |
# File 'lib/ffi-gobject/closure.rb', line 38 def store_pointer(ptr) # NOTE: Call C functions directly to avoid extra argument conversion Lib.g_closure_ref ptr Lib.g_closure_sink ptr super end |