Search code examples
ruby-on-railsrubydebuggingpry

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


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)


Solution

  • 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.