Command Line
- pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
- pry -r ./config/environemtn.rb - load your rails into a pry session
Debugger
- ls -- Show all of the available methods that can be called by an object
- _ -- Last eval
- ? -- Shows more information (doc) about an object, or method
- cat -- Display the content of a file
- file -- Represent the last file Pry touched
- wtf? -- Print the stack trace, same as ex.backtrace
- $ -- Show source, shortcut for show-source
- edit -- Open file in $EDITOR, change file are auto reloaded
- <ctrl+r> -- Search history
- out -- Array of all outputs values, also in
- cd -- Step into an object, change the value of self
- cd .. -- Take out of a level
- binding.pry -- Breakpoint
- edit --ex -- Edit the file where the last exception was thrown
- . -- Runs the command
- whereami -- Print the context where the debugger is stopped
- whereami 20 -- Print the context 20 lines where the debugger is stopped
- ; -- Would mute the return output by Ruby
- play -l -- Execute the line in the current debugging context
- rescue rspec -- break on exception in rspec
- rescue rails server -- break on exception in rails server
- try-again -- run last failing spec, reloads the file not the enviornment
pry-rescue
Just a note on showing the backtrace: The command is
_ex_.backtrace. Looks like markdown ate the underscores