Module: GirFFI::InfoExt::ISignalInfo
- Included in:
- GObjectIntrospection::ISignalInfo
- Defined in:
- lib/gir_ffi/info_ext/i_signal_info.rb
Overview
Extensions for GObjectIntrospection::ISignalInfo needed by GirFFI
Instance Method Summary collapse
- #arguments_to_gvalues(instance, arguments) ⇒ Object
- #gvalue_for_return_value ⇒ Object
-
#wrap_in_closure(&block) ⇒ GObject::RubyClosure
Create a signal hander closure.
Instance Method Details
#arguments_to_gvalues(instance, arguments) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/gir_ffi/info_ext/i_signal_info.rb', line 19 def arguments_to_gvalues(instance, arguments) arg_g_values = args.zip(arguments).map do |arg_info, arg| case arg_info.direction when :in type = arg_info.argument_type type.make_g_value.tap { |it| it.set_value arg } else raise NotImplementedError end end arg_g_values.unshift GObject::Value.wrap_instance(instance) end |
#gvalue_for_return_value ⇒ Object
33 34 35 |
# File 'lib/gir_ffi/info_ext/i_signal_info.rb', line 33 def gvalue_for_return_value return_type.make_g_value end |
#wrap_in_closure(&block) ⇒ GObject::RubyClosure
Create a signal hander closure. Wraps the given block in a custom descendent of RubyClosure with a marshaller tailored for this signal.
14 15 16 17 |
# File 'lib/gir_ffi/info_ext/i_signal_info.rb', line 14 def wrap_in_closure(&block) bldr = Builders::SignalClosureBuilder.new(self) bldr.build_class.new(&block) end |