Method: Curses::Form#driver

Defined in:
ext/curses/curses.c

#driver(command) ⇒ Object

call-seq:

driver(command)

Perform the command on the form.



4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
# File 'ext/curses/curses.c', line 4590

static VALUE
form_driver_m(VALUE obj, VALUE command)
{
    struct formdata *formp;
    int error, c;

    GetFORM(obj, formp);
    if (FIXNUM_P(command)) {
	c = NUM2INT(command);
    }
    else {
	ID id_ord;

	StringValue(command);
	CONST_ID(id_ord, "ord");
	c = NUM2INT(rb_funcall(command, id_ord, 0));
    }
#ifdef HAVE_FORM_DRIVER_W
    error = form_driver_w(formp->form,
			  FIXNUM_P(command) ? KEY_CODE_YES : OK,
			  c);
#else
    error = form_driver(formp->form, c);
#endif
    check_curses_error(error);

    return obj;
}