Last active
November 6, 2019 10:33
-
-
Save aleonjob/7e7a10b26a685997c1e27338cc6b8377 to your computer and use it in GitHub Desktop.
Use bp instead of binding.pry for debugging with pry
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For Rails, include this file within the initializers folder and ignore it or exclude it from Git | |
require 'binding_of_caller' | |
module Kernel | |
# 'bp' stands for binding.pry or break point | |
pry_alias = ENV['PRY_ALIAS'] || 'bp' | |
caller_level = 1 | |
define_method(pry_alias) do | |
Pry.start(binding.of_caller(caller_level)) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment