End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
GDBM#each
gdbm.each_pair { |key, value| block } -> gdbm
ext/gdbm/gdbm.c
View on GitHub ↗
static VALUE
fgdbm_each_pair(VALUE obj)
{
GDBM_FILE dbm;
struct dbmdata *dbmp;
VALUE keystr;
RETURN_ENUMERATOR(obj, 0, 0);
GetDBM2(obj, dbmp, dbm);
for (keystr = rb_gdbm_firstkey(dbm); RTEST(keystr);
keystr = rb_gdbm_nextkey(dbm, keystr)) {
rb_yield(rb_assoc_new(keystr, rb_gdbm_fetch2(dbm, keystr)));
GetDBM2(obj, dbmp, dbm);
}
return obj;
}
Executes block for each key in the database, passing the key and the corresponding value as a parameter.