4

Can I get current level of stack in Ruby?

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

Kara
  • 6,115
  • 16
  • 50
  • 57
fl00r
  • 82,987
  • 33
  • 217
  • 237

1 Answers1

6

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.

Daniel Pittman
  • 16,733
  • 4
  • 41
  • 34