Immediately evaluate multiple lines of code at same time in rails console when using pry?

758 views Asked by At

Suppose we have pry installed, open the rails console, and run

times = [1, 5, 10, 30, 72].sample(1)[0]
nums = *(1..72)
num_sample = nums.sample(times)

Evaluation stops after line 2 (since the output of the second line runs off screen and hence the console opens the output):

enter image description here

How can we get the console to not stop executing, but rather display the entirety of the output of one line before executing the next, that is, to execute all lines of code it receives? Is there any way to achieve this without removing the pry-rails gem?

1

There are 1 answers

3
Sergio Tulentsev On BEST ANSWER

You can disable pry pager:

Disabling paging Permanently (in a .pryrc file)

Pry.config.pager = false

Temporarily (in a repl session)

pry_instance.config.pager = false