End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
ENV.to_a
ENV.to_a → array of 2-element arrays
hash.c
View on GitHub ↗
static VALUE
env_to_a(VALUE _)
{
VALUE ary = rb_ary_new();
ENV_LOCK();
{
char **env = GET_ENVIRON(environ);
while (*env) {
char *s = strchr(*env, '=');
if (s) {
rb_ary_push(ary, rb_assoc_new(env_str_new(*env, s-*env),
env_str_new2(s+1)));
}
env++;
}
FREE_ENVIRON(environ);
}
ENV_UNLOCK();
return ary;
}