Questions tagged [pry]
Pry is an alternative to the standard Ruby interpreter, IRB.
457
questions
1
vote
1
answer
82
views
Paste multi lines in Rails console with pry
Problem: I cannot paste multi-line code as pry tries to execute every line.
Expected behavior:
[1] pry(main)> %w[a b c]
.map(&:to_sym)
=> [:a, :b, :c]
[2] pry(main)>
Actual behavior:
[1] ...
0
votes
0
answers
68
views
ruby `pry`: can I edit classes defined on the REPL?
Context: exploratory experimenting written directly in the REPL.
In pry, if I type edit fn_name I can open the definition of fn_name in an editor and change it. Say:
def fn_name
puts 'fn_name'
end
...
0
votes
0
answers
13
views
Can't install new theme of pry-theme
I'm on an old laptop learning rspec.
What I really want to do is change the color of red from the rspec --color results, because I can't read it on this old screen (the rspec version is concurrent ...
2
votes
1
answer
262
views
Unable to trap INT/TERM signals in nested Ruby processes
I'm trying to make a script that does 2 things: (1) starts a proxy and (2) runs a rails console with pry and a custom prompt
The problem is that I can't figure out how to prevent Ctrl+C interrupts ...
0
votes
0
answers
151
views
How do I use pry in bin/console in a Ruby project
I am very new to Ruby... just started learning it a couple of weeks ago. I have a project set up in the picture below:
Ruby Project Setup
The main.rb file is a module with basic arithmetic methods, ...
0
votes
1
answer
1k
views
Re-enable binding.pry after calling disable-pry
When I debug rails code, I sometimes set a binding.pry on a certain place that is triggered too often to be debugged, e.g. a loop.
Then I use the disable-pry command to step out of it and let the rest ...
2
votes
1
answer
43
views
Unexplained pry behavior in Ruby
The bug on line 11 is put there on purpose. I am curious about how pry works in this example.
In the code below, when I enter pry, if I type name I get nil, which means that pry is outputting the ...
12
votes
3
answers
3k
views
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,...
1
vote
1
answer
906
views
How to disable Pry autocomplete?
I would like to disable autocomplete in Pry. How to do it?
I'm using it in Rails console(from Emacs/inf-ruby) and it is very slow and annoying in my legacy app.
Related question: Disable irb ...
0
votes
0
answers
1k
views
Rspec test to request controller action but seems action wasn't executed
I am new to Rails and Rspec and trying to write spec to test one non RESTful controller action.
Spec code:
require 'rails_helper'
RSpec.describe ReportsController, type: :controller do
describe &...
1
vote
0
answers
101
views
How do I get show-doc to work with pry for Ruby?
I installed pry and pry-doc on Ubunutu WSL for Windows 10. When I try to use show-doc on pry to get information about a method it doesn't work.
Picture of the error I get
Here is the code:
[1] pry(...
0
votes
1
answer
173
views
How to debug inside a code block without skipping it
I'm attempting to debug my code, in order to see if @new_participant is instantiated, but when I place binding.pry around it as displayed below, it hops over the block, and placing the debugger within ...
2
votes
1
answer
145
views
How replicate rails console output style in runner script?
When running User.first in the rails console I will get a beautiful output, something like:
I assume this is taken care of by pry. How can I get the same output styling when using the runner? ...
1
vote
1
answer
247
views
How can I paste multiple line command with Docker interactive mode but not evaluating?
For example I am opening an interactive command line window.
docker exec -it container rails c
When I paste a multiple-line command, it evaluate every line instead of pasting a block. How can I ...
0
votes
2
answers
105
views
Passing arguments while debugging
I'm attempting to debug a Ruby script, but I am unable to access one method as seen below.
def move_objects(target_folder)
s3_objects.each do |obj|
binding.pry
new_key = s3_folder ? ...