instance method
ObjectSpace::WeakMap#[]=
map[key] = value → value
weakmap.c
View on GitHub ↗
static VALUE
wmap_aset(VALUE self, VALUE key, VALUE val)
{
struct weakmap *w;
TypedData_Get_Struct(self, struct weakmap, &weakmap_type, w);
VALUE pair[2] = { key, val };
st_update(w->table, (st_data_t)pair, wmap_aset_replace, (st_data_t)pair);
RB_OBJ_WRITTEN(self, Qundef, key);
RB_OBJ_WRITTEN(self, Qundef, val);
return Qnil;
}
Associates the given value with the given key.
If the given key exists, replaces its value with the given value; the ordering is not affected.