class Vips::Object
def signal_connect name, handler = nil, &block
def signal_connect name, handler = nil, &block marshal = MARSHAL_ALL[name.to_sym] raise Vips::Error, "unsupported signal #{name}" if marshal.nil? if block # our block as a Proc prc = block elsif handler # We assume the hander is a Proc (perhaps we should test) prc = handler else raise Vips::Error, "must supply either block or handler" end # The marshal function will make a closure with the right type signature # for the selected signal callback = marshal.call(prc) # we need to make sure this is not GCd while self is alive @references << callback GObject.g_signal_connect_data(self, name.to_s, callback, nil, nil, 0) end