Pry is a replacement for irb
Pry is an exploration tool
Pry is a debugging tool
Install it:
gem install pry
Install doc. package:
gem install pry-doc
* Use sudo if that's how you roll.
Run it
pry
I WANNA PLAY A GAME
[1] pry(main)>_
show a method's doc
show-doc {}.length
show a method's code
show-method {}.sum
Get help
help
Suppress output
a = (1..1000).to_a;
Bundle the gems first
gem "pry-rails"
gem "pry-code"
Do not forget to:
bundle install
Rails console is now using pry!
rails c
Put this line where you want to inspect things:
binding.pry
Forgot where you were?
whereami
Want some REAL debugger?
gem "pry-nav"
Use the
binding.pry
as your debugging start point.
step
next
continue
/