How to get the current stack level

Is it possible to get the current stack level in Ruby?

I am currently using caller.size , which is ok but does not look native

+4
source share
1 answer

caller.size is exactly what you want, as it is pretty standard, widely implemented and gives you the number of frames on the stack. This is a native feature on MRI and most other interpreters.

+6
source

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


All Articles