Skip to content

Instantly share code, notes, and snippets.

@aleonjob
Last active November 6, 2019 10:33
Show Gist options
  • Save aleonjob/7e7a10b26a685997c1e27338cc6b8377 to your computer and use it in GitHub Desktop.
Save aleonjob/7e7a10b26a685997c1e27338cc6b8377 to your computer and use it in GitHub Desktop.
Use bp instead of binding.pry for debugging with pry
# 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