Pry – Part 5 – Pry at runtime

Assuming you’ve halted the runtime at the point where you invoked the Pry REPL (see Pry – Part 4), you should have the Pry REPL.

A. The main ways of navigating the stack are the ls and cd commands.

ls shows you methods, constants and variables.

cd moves you into the new context (object or scope).

1. ls

2. cd

B. Apart from navigating state, there are two other commands that are very useful, show-method and show-doc.

1. show-method
This shows the source for a method or class.

2. show-doc shows the documentation by running the method comments through rdoc or yard