Your SlideShare is downloading. ×
0
Pry at the Ruby Drink-up of Sophia, February 2012
Pry at the Ruby Drink-up of Sophia, February 2012
Pry at the Ruby Drink-up of Sophia, February 2012
Pry at the Ruby Drink-up of Sophia, February 2012
Pry at the Ruby Drink-up of Sophia, February 2012
Pry at the Ruby Drink-up of Sophia, February 2012
Pry at the Ruby Drink-up of Sophia, February 2012
Pry at the Ruby Drink-up of Sophia, February 2012
Pry at the Ruby Drink-up of Sophia, February 2012
Pry at the Ruby Drink-up of Sophia, February 2012
Pry at the Ruby Drink-up of Sophia, February 2012
Pry at the Ruby Drink-up of Sophia, February 2012
Pry at the Ruby Drink-up of Sophia, February 2012
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Pry at the Ruby Drink-up of Sophia, February 2012

1,131

Published on

Presented at the Ruby Drink-up of Sophia Antipolis on the 7th of February 2012 by Philippe Antras (@_philant_).

Presented at the Ruby Drink-up of Sophia Antipolis on the 7th of February 2012 by Philippe Antras (@_philant_).

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,131
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. A quick overview Philippe Antras @_philant_
  • 2. PryREPLCan be invoked at runtimeObject explorationSource and documentation accessShell command executionGist integration - not shown todaySyntax highlighting, completionExtensible: plugin, commands - not shown todayRemote session with pry-remote gem and DrB http://pry.github.com
  • 3. > gem install pry
  • 4. Some Pry commandsTo get a list of all commands:Pry(main)> helpshow-doc space to escape command:show-method pry(main)> cat = "fido"history <your commands here>play -f <file>edit <file>edit [input buffer]ri Array#each
  • 5. Pry interactions ●; ●! ● edit ● <space> ● _ <underscore> ● history ● history --replay 101..105
  • 6. shell commandsPry assumes commands prefixed with a dot are shell commandspry(main)> .ls -lpry(main)> .svn updatepry(main)> .cat #{temp_file}pry(main)> shell-mode #limited completion
  • 7. Object explorationpry(main)> pry-versionPry version 0.9.7.4 on Ruby 1.8.7pry(main)> cd Prypry(Pry)> lspry(Pry)> cd @historypry(Pry)> ls -mpry(Pry)> show-doc savepry(Pry)> show-method savepry(Pry)> filename = historypry(Pry)> save filenamepry(Pry)> .cat #{filename}pry(Pry)> cd @historypry(Pry::History)> p sizepry(Pry::History)> puts sizepry(Pry::History)> nestingpry(Pry::History)> cd ../..pry(main)
  • 8. debugging with Pryruntime invocationbinding.pry<object>.prywhereami
  • 9. Documentation and source browsinginstall the pry-doc plugin:> gem install pry-docpry(main)> a = [1, 2, 3]pry(main)> ls a -mpry(main)> show-doc a.nitemspry(main)> ls Array -Mpry(main)> show-doc Array#shelljoinpry(main)> show-method Array#shelljoin
  • 10. Pry as rails console1. gemfile: gem "pry", :group => :development2. bundle install3. config/environment/development.rb silence_warnings do require "pry" IRB = Pry end4. rails console pry(main)>
  • 11. Pry customization~/.pryrc and ./.pryrc filesPry.config.inputPry.config.promptPry.config.outputPry.config.printPry.config.exception_handlerPry.config.colorPry.config.pager
  • 12. Room for improvementPry 0.9.8.1 ● no completion everywhere no file/path completion on shell commands shell-mode ● how to retrieve the output of a shell command ● object exploration does not support pwd # use nesting cd - ● cd .. issued from top level context exits # fixed in 0.9.8.1 ● issue with rspec - binding.pry => NULL pointer given
  • 13. Thank you.

×