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/environment.rb
- load your rails into a pry session
Debugger
help ls
-- Display command options for pry command lsls <Object>
-- Show all of the available methods that can be called by an object_
-- Last eval? <Object>
-- Shows more information (doc) about an object, or method_file_
-- Represent the last file Pry touchedwtf?
-- Print the stack trace, same as_ex_.backtrace
$
-- Show source, shortcut for show-sourceedit Class
-- Open file in $EDITORedit Class#instance_method
-- Open file in $EDITOR<ctrl+r>
-- Search history_out_
-- Array of all outputs values, also_in_
cd <var>
-- Step into an object, change the value of selfcd ..
-- Take out of a levelbinding.pry
-- Breakpointedit --ex
-- Edit the file where the last exception was thrown.<Shell>
-- Runs the commandwhereami
-- Print the context where the debugger is stoppedwhereami 20
-- Print the context 20 lines where the debugger is stopped;
-- Would mute the return output by Rubyplay -l
-- Execute the line in the current debugging context
next
-- execute next linestep
-- step into next function callcontinue
-- continue through stack
rescue rspec
-- break on exception in rspecrescue rails server
-- break on exception in rails servertry-again
-- run last failing spec, reloads the file not the enviornment
Want to stop the code from running after pry, without quitting the server? I use
raise-up