Questions tagged [pry]

Pry is an alternative to the standard Ruby interpreter, IRB.

Pry is an REPL (Read Eval Print Loop) interpreter, allowing to access the source code and the documentation, edit methods and execute shell commands.

http://pry.github.com/

459 questions
12
votes
2 answers

Enable stack dump on exception in Rails console

I am using Ruby on Rails with the pry gem. When an error occurs during a rake task, I get a very nice stack trace. When however I do something in my rails console that triggers an exception, I only get to see the error message and the one line of…
Pelle
  • 6,423
  • 4
  • 33
  • 50
12
votes
1 answer

rails console pry/irb "stuck" after displaying long value/string

I am developing with rails on a mac using the rails console via pry/irb. When I display a long result in the console ie. Model.all or .really_long_string, I cant seem to get past the string or value that is displayed and the console displays…
koa
  • 515
  • 6
  • 17
11
votes
1 answer

IEx Pry: Always allow / take over without prompt

When I run Elixir code with my debugger, Pry, then it always confronts me with Allow? [Yn] Can I pass a configuration option to always allow this? Thus, by default? Why is this question asked? What could be harmful?
Stobbej
  • 1,080
  • 9
  • 17
11
votes
1 answer

Elixir Pry cannot execute private methods?

Can elixir's pry run private methods from within the module? Eg: defmodule Test do require IEx def foo do IEx.pry end defp bar do end end At which point a call to bar doesn't work. I'm very new to elixir, is there something I'm…
newUserNameHere
  • 17,348
  • 18
  • 49
  • 79
11
votes
2 answers

How to quit pry loop without quiting rails console

Sometimes I'm stuck in a long loop when using binding.pry. I can quit the loop by exit-program, but the command exit rails console also. Is there easy way to exit a long loop without quitting rails console?
ironsand
  • 14,329
  • 17
  • 83
  • 176
11
votes
2 answers

Why does "23 Dogs" get parsed to 23 november 2015 in pry, but "3 Dogs" gives a parser error?

I found the below code snippet on Twitter (check post history for source). [5] pry(main)> Date.parse('3 Dogs') ArgumentError: invalid date [6] pry(main)> Date.parse('23 Dogs') => Mon, 23 Nov 2015 Is this just an easter egg in pry? If so, why this…
Nzall
  • 3,439
  • 5
  • 29
  • 59
11
votes
1 answer

Terminal cursor disappears when using Rails server and pry/byebug together

If I trigger pry or byebug, eventually while using the live-debug mode the cursor will disappear, and input will become slow/laggy. Ultimately I have to Ctrl-C and kill the unicorn/puma process. After I've quit the process the terminal works, but…
Somazx
  • 532
  • 2
  • 18
11
votes
2 answers

How do I dump Pry output to a file or Vim?

I have a Rails application, and I'm trying to export data, but directly through Pry because I only need to do it once. Is this possible with Pry? I looked at the documentation but doesn't seem like there's an easy way to dump console data anywhere.
Elijah Murray
  • 2,132
  • 5
  • 30
  • 43
11
votes
2 answers

How to instruct phantomjs to avoid timeout when using binding.pry

at some point, I don't know if you guys call it REPL-driven development or something, but I find myself inspecting the contents of my runtime by inserting a binding.pry call in some test. This works pretty well, except when I'm running Cucumber…
blackxored
  • 474
  • 5
  • 10
10
votes
1 answer

How to adjust pry colors

Edit: The faded gray is only an issue with version 0.9.7.3 and before. It has since been changed to a darker gray. Pry has nice colorizing, but the value returned when an object is created or changed is a faded gray that I can barely see. u =…
Kyle Heironimus
  • 7,741
  • 7
  • 39
  • 51
10
votes
3 answers

Why doesnt byebug/pry stop at the breakpoint in Rspec ActionMailer?

I try to debug my user_mailer.rb within my test environment. But I dont know why the debugger doesnst stop where it suppose to. So, the code I roughly have is: user_mailer_spec.rb describe UserMailer do describe '#send_notification_letters' do …
Sida Zhou
  • 3,529
  • 2
  • 33
  • 48
10
votes
3 answers

Using pry-rescue to debug exceptions in Cucumber steps

I've added an Around hook to my Cucumber features that I had hoped would cause pry-rescue to start pry when an exception was thrown: Around do |scenario, block| Pry::rescue do block.call end end The Around hook is definitely being called,…
Duncan Bayne
  • 3,870
  • 4
  • 39
  • 64
10
votes
1 answer

Difference between pry and pry-rails

What is the difference (implementation wise) in pry gem and pry-rails gem?
9
votes
2 answers

Debugging in JRuby 9000

What is the best way to debug in JRuby 9000? Pry and Byebug are both MRI-dependent. All the JRuby info that I have found seem to be only for pre-9k, and are not working for my JRuby 9k setup.
RezaF
  • 123
  • 1
  • 6
9
votes
1 answer

Use pry-rescue In a rake Task?

I'm trying to use pry-rescue inside of a rake task. Something like this: bundle exec rescue rake my:task But when an exception occurs (undefined method...) it just exists like normal. How can I use pry-rescue with my rake task?
Gil Birman
  • 35,242
  • 14
  • 75
  • 119
1 2
3
30 31