0.01
Low commit activity in last 3 years
Additional commands for Byebug that skip over garbage frames
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 11.1.3
 Project Readme

byebug-skipper

Logo

Are you tired of going...

up
up
up
up

... and...

down
down
down
down

... in Byebug, through dozens of frames of crap you don't care about, just to see your own code? Then this is the gem for you.

Installation

At the gem to your Gemfile.

gem 'byebug-skipper'

And require it just after byebug (or pry-byebug).

require 'byebug'
require 'byebug/skipper'

Usage

This gem adds a few new commands to Byebug: ups, downs, steps, and finishs. These work exactly the same as the built in up, down, step and finish commands, except they skip over frames of garbage. Bon appétit.

It also adds a skip! command, which works like Byebug's skip except it also comments out the line above the current line, which is usually where you put byebug or binding.pry, so that next time you run your code it won't stop there again. Radical!

Pry Support

This gem will also add it's commands (except skip!) to Pry if the pry-byebug gem is loaded. Either require 'byebug-skipper' afterwards:

require 'pry-byebug'
require 'byebug/skipper'

Or directly require the special Pry entry point:

require 'byebug/skipper/pry'

The skip! command is not available because it doesn't seem to work, I don't know why, and also pry-byebug does not provide a skip command.

Configuration

By default, the commands in this gem will skip frames that come from gems and Ruby built-ins. It does this by looking at the file paths to see if they contain something that looks like /ruby/2.7.3/gems/.

If that's not good enough for you, you can configure your own matchers. If any of these match the file location, the frame will be skipped.

Byebug::Skipper.skip_matchers = [
  %r{app/controllers/application_controller.rb},
  /_spec\.rb/,
  /stuff/,
]

The elements of this array must implement the #=== method (e.g. regular expressions implement this), and will be provided a string containing the absolute path and line number of the frame, like /path/to/whatever.rb:55.

Contributing

Open a pull request.