Use rb_rational_num and rb_rational_den