End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
ObjectSpace::WeakMap#keys
keys
gc.c
View on GitHub ↗
static VALUE
wmap_keys(VALUE self)
{
struct weakmap *w;
struct wmap_iter_arg args;
TypedData_Get_Struct(self, struct weakmap, &weakmap_type, w);
args.objspace = &rb_objspace;
args.value = rb_ary_new();
st_foreach(w->wmap2obj, wmap_keys_i, (st_data_t)&args);
return args.value;
}
Iterates over keys and objects in a weakly referenced object