Is There a Pry Debug Setup That Works with Ruby 2.0

Is there a pry debug setup that works with ruby 2.0?

pry-byebug 1.1.1+ works with ruby 2.0.0-p247. It's a fork of pry-debugger & works with ruby 2.0+ only.

gem 'pry-byebug'

https://github.com/deivid-rodriguez/pry-byebug

updated with version numbers

How to use the debugger with Ruby 2.0?

The debugger gem can be used but it still has issues.

Install byebug which was written for Ruby 2.0 debugging.

For breakpoints, use the byebug command in your code instead of debugger.

Using Rails4.1.1 and Ruby 2.0.0, binding.pry's terminal output is sometimes empty

Are you using pry-debugger? If so, with Ruby 2+, you may want to change to pry-byebug. There is some kind of linecache incompatibility between Ruby 1.9 & 2.x, and byebug fixes that.

RubyMine fails at rails 4, ruby 2.0.0-p0 debugging

Debugger gem must not be used, it conflicts with ruby-debug-ide and breaks it.

UPDATE: RubyMine 6+ supports debugger gem.

Executing a .rb file (Ruby file) with PRY in Windows 7

  1. Make sure you've installed pry and pry-debugger gems
  2. At the top of your file, add statements for require 'pry' and require 'pry-debugger'
  3. In your code, wherever you want to start ddebugging, just add a statement binding.pry
  4. Now, you can run your file like ruby filename.rb and the debugger should open

Is there the equivalent of next in Pry?

If you want (this and more) debugging features you'll need to use pry_debug: https://github.com/Mon-Ouie/pry_debug

How to use pry-byebug in an example script for a gem?

Ok, looking into this more I realized (I think...still kind of new to the game) a couple things --

1.) If you want to if have

require 'pry'

at the top of your ruby file and have it work in general, it would help to install it in your development environment using your terminal:

user@machine/currentdirectory/$ gem install pry 

likewise with pry-byebug:

user@machine/currentdirectory/$ gem install pry-byebug

2.) The real answer to my initial question is to use

byebug

in my script as the debugging hook, instead of

binding.pry

(thanks @mtm for the suggestion!)

when I do use byebug though, while step and next work properly, the REPL it throws me into doesn't have any color, and isn't as nice in general...anyway to fix that?



Related Topics



Leave a reply



Submit