End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Kernel#global_variables
global_variables → array
eval.c
View on GitHub ↗
static VALUE
f_global_variables(VALUE _)
{
return rb_f_global_variables();
}
Returns an array of the names of global variables. This includes special regexp global variables such as $~ and $+, but does not include the numbered regexp global variables ($1, $2, etc.).
Example
global_variables.grep /std/ #=> [:$stdin, :$stdout, :$stderr]