I'm using the C extension methods to create a new ruby array, but RARRAY_LEN is not getting set. Am I doing something wrong?
long int max = 4;
VALUE rAry;
rAry = rb_ary_new2(max);
printf("allocated: %lu\n", RARRAY_LEN(rAry));
output:
allocated: 0
Apparently rb_ary_store(obj, index, val) needs to be used to increment RARRAY_LEN. It's strange that a method so crucial is basically undocumented.