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
9
votes
2 answers

before_session hook failed: Pry::CommandError: Cannot locate this method: load

Loading up the Pry REPL in a Ruby script I get this odd error: before_session hook failed: Pry::CommandError: Cannot locate this method: load. ~/.rvm/gems/ruby-2.0.0-p195/gems/pry-0.9.12.2/lib/pry/method.rb:498:in `pry_doc_info' (see…
Snowcrash
  • 80,579
  • 89
  • 266
  • 376
8
votes
3 answers

Why won't Pry run in Heroku's console?

My goal is to use Pry as the console for my Rails app, both locally and on my staging server. But I can't get it to work on Heroku. I'm following these instructions to get Heroku to use Pry as the console for my Rails app. When I run heroku run…
thewillcole
  • 2,943
  • 3
  • 30
  • 35
8
votes
1 answer

How to use original "break" in a loop when using pry-debugger

How can I use break in a loop while using pry-debugger that has break function? 10.times do |i| break if i > 2 end This code will fail with error ArgumentError: Cannot identify arguments as breakpoint.
ironsand
  • 14,329
  • 17
  • 83
  • 176
8
votes
2 answers

Unicorn & Pry in Rails

I'm unable to use pry with Unicorn as I get booted out of my prompt after sometime. Here is a quick overview: In a custom action in a controller I have this: def assign binding.pry end Getting to this route is no problem and I even get the…
Anthony
  • 15,435
  • 4
  • 39
  • 69
8
votes
2 answers

Stop Pry from putting each value of a returned array on a new line?

I watched the RubyConf 2013 talk on Pry and I have decided I ought to give it a good try. I am working with some large arrays. It would be easier to work with my code if Pry would display returned arrays the way IRB does. What seems odd is that…
Huliax
  • 1,489
  • 3
  • 15
  • 27
8
votes
1 answer

Rails: run code ignoring binding.pry

I often use the pry-byebug gem to put breakpoints in my code using binding.pry However, during debugging (say after making a slight change) I often want to run the entire code/spec without any breakpoints for that one time. Is there an option to…
codeObserver
  • 6,521
  • 16
  • 76
  • 121
8
votes
5 answers

vim-ruby-debugger style breakpoints with Pry in Vim

Right now, when I want a breakpoint in vim or Sublime Text, I drop a line like the following into the code: binding.pry if Rails.env.test? Pry (and its associated plugins) provide a nice environment in which to do interactive Ruby debugging from…
user456584
  • 86,427
  • 15
  • 75
  • 107
8
votes
2 answers

binding.pry in BasicObject

pry would be great for debugging a subclass of BasicObject ! https://github.com/pry/pry says that pry has: "Exotic object support (BasicObject instances..." But how to do that? As can be expected a BasicObject does not understand binding. …
Ernst
  • 235
  • 2
  • 12
7
votes
2 answers

How do I capture the output of a pry shell command?

I'm using pry and I want to capture, and work with output of a shell command. For example, If I run pry(main)> .ls I want to get the list of files into an array that I can work with in Ruby. How can I do this?
Brian
  • 4,931
  • 3
  • 32
  • 55
7
votes
3 answers

binding.pry not works with command bin/dev

binding.pry not works(console input not available) if i start the server with bin/dev command. It only works with bin/rails s command. I understand it has something to do with foreman and Procfile.dev, but I don't know how. Is this a bug or is it…
Artem P
  • 138
  • 7
7
votes
1 answer

How to call a method and immediately step into it

When, during a pry debug session, I want to inspect step-by-step execution of FooClass.new.foo I'd do this in pry console $ FooClass.new.foo #this gives me path and line of the method break…
Greg
  • 5,862
  • 1
  • 25
  • 52
7
votes
0 answers

Pry session timing out because of Puma worker timeout

Whenever I hit a binding.pry while running an app locally, I enter the pry session as normal, but after about a minute, I see something like this in my server output. [54438] ! Terminating timed out worker: 54455 Then the server seems to run in a…
James Stonehill
  • 1,125
  • 10
  • 22
7
votes
2 answers

How can I watch a variable in Ruby Pry?

I'm using Ruby 2.2.2, Pry and 'pry-byebug'. The continue statement removes any watched variables in have in pry-byebug: [1] pry(main)> watch foo Watching foo watch: foo => 42 [2] pry(main)> watch Listing all watched expressions: 1: foo => 42 [3]…
Sasgorilla
  • 2,403
  • 2
  • 29
  • 56
7
votes
2 answers

Binding pry not being called in test environment

I'm currently writing specs for my Rails controller. I can't seem to get any puts statement or binding.pry, or binding.remote_pry working. I am able to get the remote pry working in the development environment. group :development, :test do gem…
Sherwyn Goh
  • 1,352
  • 1
  • 10
  • 19
7
votes
0 answers

binding.pry ignored by rspec

I am expecting a pry session to be opened in my console during execution of rspec. Am I doing something incorrect? Or expecting the wrong behavior? Gemfile: group :development, :test do gem 'rspec' gem 'rspec-rails' ... gem 'pry-rails' …
Eric Francis
  • 23,039
  • 31
  • 88
  • 122