End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
ObjectSpace::WeakMap#[]=
[]=(p1, p2)
gc.c
View on GitHub ↗
static VALUE
wmap_aset(VALUE self, VALUE key, VALUE value)
{
struct weakmap *w;
TypedData_Get_Struct(self, struct weakmap, &weakmap_type, w);
if (FL_ABLE(value)) {
define_final0(value, w->final);
}
if (FL_ABLE(key)) {
define_final0(key, w->final);
}
st_update(w->obj2wmap, (st_data_t)value, wmap_aset_update, key);
st_insert(w->wmap2obj, (st_data_t)key, (st_data_t)value);
return nonspecial_obj_id(value);
}
Creates a weak reference from the given key to the given value