简体   繁体   中英

Ruby Global Variables

在Ruby中有没有任何方法列出检查点可用的所有全局变量,比如php中的$GLOBALS

Yes. There is Kernel#global_variables .

puts global_variables

Since it's a method from Kernel, you can call it without having to mention the class name.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM