dimid dimid - 6 months ago 11
Ruby Question

How to reference an earlier output in pry

In python's

ipython
you can reference the output in the following way:

In [15]: s = "abcd"

In [16]: s
Out[16]: 'abcd'

In [17]: Out[16]
Out[17]: 'abcd'


What is the equivalent for ruby's
pry
?

Answer

Using the _out_ and _in_ variables, as described in the docs.

E.g.: _out_[16] or _out_[-1] for the last result.