I'm using Ruby 2.2.2, Pry and 'pry-byebug'. The continue
statement removes any watched variables in have in pry-byebug
:
[1] pry(main)> watch foo
Watching foo
watch: foo => 42
[2] pry(main)> watch
Listing all watched expressions:
1: foo => 42
[3] pry(main)> continue
[1] pry(main)> watch
No watched expressions
Losing them on every continue
makes watched expressions pretty worthless. If I use next
and step to the same point in the code instead, the watched expressions are still there; it's just the continue
that causes the problem. At the moment I can't even find any documentation on the watch
statement, so I don't know why this occurs.
More generally, I just want to print out the value of a set of expressions on every Pry prompt (or, perhaps, print them out if they've changed since the last time they were printed.) How can I achieve this in a Ruby debugger?