Ruby and Pry (or other debugging gem): How can I show the definition of a variable?

497 Views Asked by At

I need to know how to check where the variable is - if not defined - then where it is assigned. Via Pry or similar gem (or Ruby standard library, that is - if possible)

1

There are 1 best solutions below

3
svelandiag On BEST ANSWER

I think this is the closest I can come up with right now to answer your question. Please check pry-moves

You could use it to debug the start-up of the execution of your program and use watch variable (if you at least know the name of the variable) and look when it gets a value, there you would know in which step of the execution it is defined/declared.