End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
DBM#include?
dbm.include?(key) → boolean
ext/dbm/dbm.c
View on GitHub ↗
static VALUE
fdbm_has_key(VALUE obj, VALUE keystr)
{
datum key, val;
struct dbmdata *dbmp;
DBM *dbm;
long len;
ExportStringValue(keystr);
len = RSTRING_LEN(keystr);
if (TOO_LONG(len)) return Qfalse;
key.dptr = RSTRING_PTR(keystr);
key.dsize = (DSIZE_TYPE)len;
GetDBM2(obj, dbmp, dbm);
val = dbm_fetch(dbm, key);
if (val.dptr) return Qtrue;
return Qfalse;
}
Returns true if the database contains the specified key, false otherwise.