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
- Make sure you've installed
pry
andpry-debugger
gems - At the top of your file, add statements for
require 'pry'
andrequire 'pry-debugger'
- In your code, wherever you want to start ddebugging, just add a statement
binding.pry
- 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
What Is the Purpose of the Enumerator Class in Ruby
Why Does a Simple Thin Server Stop Responding at 16500 Requests When Benchmarking
Get, or Calculate the Entropy of an Image with Ruby and Imagemagick
Instance Variable, Class Variable and the Difference Between Them in Ruby
Configuration in Allure to Cucumber in Ruby
Is This the Best Way to Grab Common Elements from a Hash of Arrays
Alphabetize Arabic and Japanese Text That Is in Unicode
Clicking Link with JavaScript in Mechanize
Trying to Compare Two Text Files, and Create a Third Based on Information
Soap Client for Ruby 1.9 and Rails
Upgraded to Ruby 1.9.2 and Getting Segmentation Fault Errors in Nokogiri
How to Remove Xcode 4.2 and Install 4.1 to Develop Ruby/Rails on Osx Lion
Rvm System-Wide Install Script Url Broken -- What Is Replacement
Programmatically Derive a Regular Expression from a String
Ruby Incorrectly Parses 2 Digit Year
Script to Run Against Stdin If No Arg; Otherwise Input File =Argv[0]