Skip to content
instance method

Kernel#global_variables

() -> ::Array[::Symbol]
global_variables → array

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]
See also #gets #gsub #gem #Hash also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0