I love pry!
See this if you’re on zeitwerk and moving away from byebug:
If you’re still on byebug, keep reading:
Here’s my .pryrc
Gems I use for Pry:
gem "pry"
gem "pry-rails"
gem "pry-byebug"
gem "pry-doc"
gem "pry-rescue"
gem "awesome_print"
Commands for Help
Once you’ve installed you, can run:
Tip: Run help alias
Aliases
!!! Alias for `exit-program`
!!@ Alias for `exit-all`
$ Alias for `show-source`
? Alias for `show-doc`
@ Alias for `whereami`
bb Alias for `break`
breakpoint Alias for `break`
cc Alias for `continue`
clipit Alias for `gist --clip`
dd Alias for `down`
ff Alias for `frame`
file-mode Alias for `shell-mode`
fin Alias for `finish`
find-routes Alias for `find-route`
h Last 20 commands
hG Commands matching expression ever used
hg Up to 20 commands matching expression
history Alias for `hist`
hr Hist -r <command number> to run a command
nn Alias for `next`
quit Alias for `exit`
quit-program Alias for `exit-program`
reload-method Alias for `reload-code`
show-method Alias for `show-source`
ss Alias for `step`
uu Alias for `up`
ww Alias for `whereami`
or run more_help
Helpful shortcuts:
hh : hist -T 20 Last 20 commands
hg : hist -T 20 -G Up to 20 commands matching expression
hG : hist -G Commands matching expression ever used
hr : hist -r hist -r <command number> to run a command
Samples variables
a_array : [1, 2, 3, 4, 5, 6]
a_hash : { hello: "world", free: "of charge" }
helper : Access Rails helpers
app : Access url_helpers
require "rails_helper" : To include Factory Girl Syntax
include FactoryGirl::Syntax::Methods : To include Factory Girl Syntax
or if you defined one...
require "pry_helper"
Sidekiq::Queue.new.clear : To clear sidekiq
Sidekiq.redis { |r| puts r.flushall } : Another clear of sidekiq
Debugging Shortcuts
ss : step
nn : next
cc : continue
fin : finish
uu : up
dd : down
ff : frame
bb : break
ww : whereami