key?(p1)
public
Returns true if the given key k
exists within the database. Returns false otherwise.
static VALUE
fgdbm_has_key(VALUE obj, VALUE keystr)
{
datum key;
struct dbmdata *dbmp;
GDBM_FILE dbm;
long len;
ExportStringValue(keystr);
len = RSTRING_LENINT(keystr);
if (TOO_LONG(len)) return Qfalse;
key.dptr = RSTRING_PTR(keystr);
key.dsize = (int)len;
GetDBM2(obj, dbmp, dbm);
if (gdbm_exists(dbm, key))
return Qtrue;
return Qfalse;
}