How to debug Ruby scripts

debugging, ruby

Solution

Use Pry (GitHub).

Install via:

$ gem install pry
$ pry

Then add:

require 'pry'; binding.pry

into your program.

As of `pry` 0.12.2 however, there are no navigation commands such as `next`, `break`, etc. Some other gems additionally provide this, see for example `pry-byebug`.

Problem

I copied the following Ruby code from the Internet and made a few changes but it doesn't work. What can I do to debug the program by myself?

Original source

Related problems