GithubHelp home page GithubHelp logo

hoylemd / byebug-skipper Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tomdalling/byebug-skipper

0.0 0.0 0.0 67 KB

Extra Byebug commands that skip garbage

License: MIT License

JavaScript 3.07% Ruby 96.93%

byebug-skipper's Introduction

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.

byebug-skipper's People

Contributors

tomdalling avatar actions-user avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.