I'm sure you need to use the RARRAY_PTR macro on pairs to get into the base array; for example, the internal implementation of the # push array (for 1.9.2) is as follows:
static VALUE rb_ary_push_1(VALUE ary, VALUE item) { long idx = RARRAY_LEN(ary); if (idx >= ARY_CAPA(ary)) { ary_double_capa(ary, idx); } RARRAY_PTR(ary)[idx] = item; ARY_SET_LEN(ary, idx + 1); return ary; }
if just sorts any needed resizing, and then RARRAY_PTR(ary)[idx] to access one slot in the array.
I have no official links to this, but hopefully it will be useful.
source share