End of Life Ruby 3.0 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 _)
{
char **env;
VALUE ary;
ary = rb_ary_new();
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);
return ary;
}