method
store
ruby latest stable - Class:
GDBM
store(p1, p2)public
Associates the value value with the specified key.
static VALUE
fgdbm_store(VALUE obj, VALUE keystr, VALUE valstr)
{
datum key, val;
struct dbmdata *dbmp;
GDBM_FILE dbm;
rb_gdbm_modify(obj);
ExportStringValue(keystr);
ExportStringValue(valstr);
key.dptr = RSTRING_PTR(keystr);
key.dsize = RSTRING_LENINT(keystr);
val.dptr = RSTRING_PTR(valstr);
val.dsize = RSTRING_LENINT(valstr);
GetDBM2(obj, dbmp, dbm);
dbmp->di_size = -1;
if (gdbm_store(dbm, key, val, GDBM_REPLACE)) {
if (errno == EPERM) rb_sys_fail(0);
rb_raise(rb_eGDBMError, "%s", gdbm_strerror(gdbm_errno));
}
return valstr;
} Related methods
- Instance methods
- []
- []=
- cachesize=
- clear
- close
- closed?
- delete
- delete_if
- each
- each_key
- each_pair
- each_value
- empty?
- fastmode=
- fetch
- has_key?
- has_value?
- include?
- index
- invert
- key
- key?
- keys
- length
- member?
- reject
- reject!
- reorganize
- replace
- select
- shift
- size
- store
- sync
- syncmode=
- to_a
- to_hash
- update
- value?
- values
- values_at
- Class methods
- new
- open