End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
GDBM#to_hash
gdbm.to_hash → hash
ext/gdbm/gdbm.c
View on GitHub ↗
static VALUE
fgdbm_to_hash(VALUE obj)
{
struct dbmdata *dbmp;
GDBM_FILE dbm;
VALUE keystr, hash;
GetDBM2(obj, dbmp, dbm);
hash = rb_hash_new();
for (keystr = rb_gdbm_firstkey(dbm); RTEST(keystr);
keystr = rb_gdbm_nextkey(dbm, keystr)) {
rb_hash_aset(hash, keystr, rb_gdbm_fetch2(dbm, keystr));
}
return hash;
}
Returns a hash of all key-value pairs contained in the database.