to_a(*args)
public
Returns an array containing the items in enum.
(1..7).to_a
{ 'a'=>1, 'b'=>2, 'c'=>3 }.to_a
require 'prime'
Prime.entries 10
Show source
static VALUE
enum_to_a(int argc, VALUE *argv, VALUE obj)
{
VALUE ary = rb_ary_new();
rb_block_call(obj, id_each, argc, argv, collect_all, ary);
OBJ_INFECT(ary, obj);
return ary;
}