简体   繁体   中英

How to get current stack level

Can I get current level of stack in Ruby?

Currently I use caller.size which is ok, but looks not native

caller.size is pretty much exactly what you want, since it is fairly standard, widely implemented, and gives you the number of frames on the stack. It is a native function on MRI, and most other interpreters.

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