Ruby global variables

Is there any method in Ruby that lists all the global variables available at the checkpoint, like $GLOBALSin php?

+3
source share
1 answer

Yes. There is Kernel#global_variables.

puts global_variables

Since this is a method from the kernel, you can name it without mentioning the class name.

+2
source

Source: https://habr.com/ru/post/1734904/


All Articles