Method: List#to_a

Defined in:
ext/list/list.c

#to_aObject



569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
# File 'ext/list/list.c', line 569

static VALUE
list_to_a(VALUE self)
{
  list_t *ptr;
  item_t *c;
  VALUE ary;
  long i = 0;

  Data_Get_Struct(self, list_t, ptr);
  ary = rb_ary_new2(ptr->len);
  LIST_FOR(ptr, c) {
    rb_ary_store(ary, i++, c->value);
  }
  return ary;
}