Project

d2

0.0
No commit activity in last 3 years
No release in over 3 years
A cross-version compatible shortcut for invoking a Ruby debugger that will run properly under the currently executing environment.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 1.1.4
 Project Readme

d2

A cross-version compatible shortcut for invoking a Ruby debugger that always tries to do the right thing™ no matter which platform you're running under.

This gem is a trivial layer built upon the hard work of giants, and I sure wouldn't blame you if you preferred not to use it. See the alternative pattern in my article about cross-version debugging in Ruby.

Drop d2 into your Gemfile:

group :development, :test do
  gem "d2"
end

Make sure you're using Bundler.require somewhere in your project (Rails does this automatically), or include a require 'd2' somewhere (like in your test_helper.rb).

You're ready to go:

def requires_frequent_debugging
  risky_call rescue nil
  Singleton.manipulate_global_state
  d # drop me here!
  Model.do_business_logic
  super
end