It is no doubt that one of the activities that takes most of the time of software developers is debugging. We as programmers can make many mistakes, which may lead to many bugs that need to be fixed. One of the best ways to fix these bugs, understand the flow of an application, or implement new features is through debugging. ByeBug is a great Ruby gem that helps us fix bugs and debug projects by going through each line. It is similar to pry, with additional functionalities.
As the name mentions it, this gem helps you say Bye to your bugs. Aside from the breakpoints and stopping the execution process, ByeBug makes it possible to step through a Ruby program, one line at a time and more. It gives you the opportunity to check the value of a variable, and even execute commands and examine the current state.
It can be installed as any other Ruby gem:
gem install byebug
in a Rails project.
After you have installed it, you can then start to use it. (If you are using it inside a Rails project, you should restart your server)
You can check the value of a variable by writing the name of it. You can put a breakpoint and stop the execution at a specific execution point using byebug. Then you can go to the next line by writing next or simply n.
One thing I wish this gem had was having color coded display in the terminal as pry does. As it an open source project, you are more than welcome to go and learn from the source code and also give your contribution and help this gem get better.