Contenu connexe
Similaire à Some Pry Features (20)
Some Pry Features
- 3. 1 - Basics
ls - list methods
? - show documentation
$ - show source code
- 4. 2 - History
[4] pry(main)> hist
1: (0..5).each do |number|
2: puts number
3: end
- 5. 2 - History - replay
[5] pry(main)> hist --replay 1..3
0
1
…
- 6. 2 - History - all
[35] pry(main)> hist --all --tail 100
Use --all option to list all pry history
- 7. [6] pry(main)> def fullname
[7] pry(main)> [first, last].compact.join(' ')
[8] pry(main)> edit
3 - Editor
- 11. 4 - Copy to clipboard
gem install gist
[9] pry(main)> clipit fullname
Copied content to clipboad!
- 12. 5 - Reload
# Ruby
load 'lib/user.rb'
#Rails
reload!
with IRB
- 13. 5 - Reload
[1] pry(main)> user = User.last
[2] pry(main)> edit user
with PRY
- 15. [1] pry(main)> user = User.last
[2] pry(main)> edit user
[2] pry(main)> user.fullname
=> "John Doe"
5 - Reload
with PRY