4

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?

stevec
  • 41,291
  • 27
  • 223
  • 311

1 Answers1

3

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
Sergio Tulentsev
  • 226,338
  • 43
  • 373
  • 367
  • I just went to upvote the question and answer, and realised it was my question and I'd already upvoted the answer. Am I the only one that tries to do this. Is it an anti pattern of some sort? I need to drop multiple lines into the rails console fairly frequently. – stevec Dec 14 '20 at 06:18
  • 1
    @stevec: just a few days ago _I myself_ googled how to do this, found this answer and tried to upvote it :) – Sergio Tulentsev Dec 14 '20 at 09:12
  • 1
    dude hudreds and thousands of thanks to you, i got mad over last 2-3 days thinking of a way to fix this. i tried to enable infinite scrollback, overriding touchpad from keyboard arrow keys and what now. Thanks much – Shubham kumar Dec 20 '22 at 22:23