static VALUE obj_each(VALUE klass, const char *name) { struct objlist *nobj; int i, n; VALUE inst, id, ary; nobj = ngraph_get_object(name); n = ngraph_get_object_last_id(nobj) + 1; if (n < 1) { return klass; } name = ngraph_get_object_name(nobj); ary = rb_ary_new2(n); for (i = 0; i < n; i++) { id = INT2FIX(i); inst = obj_get(klass, id, name); rb_ary_store(ary, i, inst); } rb_ary_each(ary); return klass; }
/* * call-seq: * each_record { |record| ... } * * Parses the records inside the result set and call the given block for each * record, passing a reference to a ZOOM::Record object as parameter. * * Returns: self. */ static VALUE rbz_resultset_each_record (VALUE self) { rb_ary_each (rbz_resultset_records (self)); return self; }