- klass = rb_hash_aref (event_classes, INT2NUM (type));
- if (NIL_P (klass))
- rb_raise (rb_eException, "Cannot find event class "
- "for event %i\n", type);
-
- /* now create and init the object */
- tmp = (VALUE) event;
- obj = rb_class_new_instance (1, &tmp, klass);
-
- len = RARRAY (handlers)->len;
-
- for (i = 0; i < len; i++) {
- handler = rb_ary_entry (handlers, i);
- Data_Get_Struct (handler, RbEventHandler, h);
-
- if (h->type == type) {
- res = rb_funcall (h->callback, rb_intern ("call"), 1, obj);
-
- /* if the block returned false, don't call the other
- * event handlers
- */
- if (res == Qfalse) {
- ret = 0;
- break;
- }
- }
- }
-
- return ret;