Can I get current level of stack in Ruby?
Currently I use caller.size which is ok, but looks not native
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
caller.sizeis 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.