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

R
A quick overview   Philippe Antras
                       @_philant_
Pry

REPL
Can be invoked at runtime
Object exploration
Source and documentation access
Shell command execution
Gist integration - not shown today
Syntax highlighting, completion
Extensible: plugin, commands - not shown today
Remote session with pry-remote gem and DrB




                                        http://pry.github.com
> gem install pry
Some Pry commands
To get a list of all commands:
Pry(main)> help
show-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
Pry interactions

 ●;
 ●!
 ● edit
 ● <space>
 ● _ <underscore>
 ● history
 ● history --replay 101..105
shell commands

Pry assumes commands prefixed with a dot are shell commands

pry(main)> .ls -l
pry(main)> .svn update

pry(main)> .cat #{temp_file}

pry(main)> shell-mode    #limited completion
Object exploration
pry(main)> pry-version
Pry version 0.9.7.4 on Ruby 1.8.7
pry(main)> cd Pry
pry(Pry)> ls
pry(Pry)> cd @history
pry(Pry)> ls -m
pry(Pry)> show-doc save
pry(Pry)> show-method save
pry(Pry)> filename = 'history'
pry(Pry)> save filename
pry(Pry)> .cat #{filename}
pry(Pry)> cd @history
pry(Pry::History)> p size
pry(Pry::History)> puts size
pry(Pry::History)> nesting
pry(Pry::History)> cd ../..
pry(main)
debugging with Pry
runtime invocation

binding.pry

<object>.pry

whereami
Documentation and source browsing

install the pry-doc plugin:
> gem install pry-doc

pry(main)> a = [1, 2, 3]
pry(main)> ls a -m
pry(main)> show-doc a.nitems
pry(main)> ls Array -M
pry(main)> show-doc Array#shelljoin
pry(main)> show-method Array#shelljoin
Pry as rails console

1. gemfile:
   gem "pry", :group => :development
2. bundle install
3. config/environment/development.rb
   silence_warnings do
      require "pry"
      IRB = Pry
   end
4. rails console
   pry(main)>
Pry customization

~/.pryrc and ./.pryrc files

Pry.config.input
Pry.config.prompt
Pry.config.output
Pry.config.print
Pry.config.exception_handler
Pry.config.color
Pry.config.pager
Room for improvement

Pry 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
Thank you.
1 of 13

Recommended

Sp ch05 by
Sp ch05Sp ch05
Sp ch05Shi-Wu Lo(Gmail)
50 views39 slides
Linux Command Line by
Linux Command LineLinux Command Line
Linux Command LinePrima Yogi Loviniltra
433 views10 slides
50 Perintah Dasar pada linux by
50 Perintah Dasar pada linux50 Perintah Dasar pada linux
50 Perintah Dasar pada linuxReskyRian
642 views51 slides
Perintah perintah dasar linux Operating Sistem by
Perintah perintah dasar linux Operating SistemPerintah perintah dasar linux Operating Sistem
Perintah perintah dasar linux Operating SistemRoziq Bahtiar
1.6K views23 slides
NUMOSS 4th Week - Commandline Tutorial by
NUMOSS 4th Week - Commandline TutorialNUMOSS 4th Week - Commandline Tutorial
NUMOSS 4th Week - Commandline TutorialGagah Arifianto
225 views10 slides
gitfs by
gitfsgitfs
gitfsTemian Vlad
541 views56 slides

More Related Content

What's hot

자바스터디 4 by
자바스터디 4자바스터디 4
자바스터디 4jangpd007
785 views15 slides
Python utan-stodhjul-motorsag by
Python utan-stodhjul-motorsagPython utan-stodhjul-motorsag
Python utan-stodhjul-motorsagniklal
527 views50 slides
Instalasi Network Monitoring System (Nagios) Ubuntu 12.04 by
Instalasi Network Monitoring System (Nagios) Ubuntu 12.04Instalasi Network Monitoring System (Nagios) Ubuntu 12.04
Instalasi Network Monitoring System (Nagios) Ubuntu 12.04Febi Gelar Ramadhan
529 views7 slides
Стажировка 2016-07-27 02 Денис Нелюбин. PostgreSQL и jsonb by
Стажировка 2016-07-27 02 Денис Нелюбин. PostgreSQL и jsonbСтажировка 2016-07-27 02 Денис Нелюбин. PostgreSQL и jsonb
Стажировка 2016-07-27 02 Денис Нелюбин. PostgreSQL и jsonbSmartTools
354 views29 slides
Goの標準的な開発の流れ by
Goの標準的な開発の流れGoの標準的な開発の流れ
Goの標準的な開発の流れRyuji Iwata
449 views5 slides
How Secure Are Docker Containers? by
How Secure Are Docker Containers?How Secure Are Docker Containers?
How Secure Are Docker Containers?Ben Hall
374 views84 slides

What's hot(20)

자바스터디 4 by jangpd007
자바스터디 4자바스터디 4
자바스터디 4
jangpd007785 views
Python utan-stodhjul-motorsag by niklal
Python utan-stodhjul-motorsagPython utan-stodhjul-motorsag
Python utan-stodhjul-motorsag
niklal527 views
Instalasi Network Monitoring System (Nagios) Ubuntu 12.04 by Febi Gelar Ramadhan
Instalasi Network Monitoring System (Nagios) Ubuntu 12.04Instalasi Network Monitoring System (Nagios) Ubuntu 12.04
Instalasi Network Monitoring System (Nagios) Ubuntu 12.04
Стажировка 2016-07-27 02 Денис Нелюбин. PostgreSQL и jsonb by SmartTools
Стажировка 2016-07-27 02 Денис Нелюбин. PostgreSQL и jsonbСтажировка 2016-07-27 02 Денис Нелюбин. PostgreSQL и jsonb
Стажировка 2016-07-27 02 Денис Нелюбин. PostgreSQL и jsonb
SmartTools354 views
Goの標準的な開発の流れ by Ryuji Iwata
Goの標準的な開発の流れGoの標準的な開発の流れ
Goの標準的な開発の流れ
Ryuji Iwata449 views
How Secure Are Docker Containers? by Ben Hall
How Secure Are Docker Containers?How Secure Are Docker Containers?
How Secure Are Docker Containers?
Ben Hall374 views
Using Puppet to Create a Dynamic Network - PuppetConf 2013 by Puppet
Using Puppet to Create a Dynamic Network - PuppetConf 2013Using Puppet to Create a Dynamic Network - PuppetConf 2013
Using Puppet to Create a Dynamic Network - PuppetConf 2013
Puppet3.9K views
Using the Power to Prove by Kazuho Oku
Using the Power to ProveUsing the Power to Prove
Using the Power to Prove
Kazuho Oku2.8K views
Serializing Ruby Objects in Redis by Brian Kaney
Serializing Ruby Objects in RedisSerializing Ruby Objects in Redis
Serializing Ruby Objects in Redis
Brian Kaney9K views
Linux cheat-sheet by Craig Cannon
Linux cheat-sheetLinux cheat-sheet
Linux cheat-sheet
Craig Cannon4.3K views
Gitosis on Mac OS X Server by Yasuhiro Asaka
Gitosis on Mac OS X ServerGitosis on Mac OS X Server
Gitosis on Mac OS X Server
Yasuhiro Asaka2.4K views
PuppetDB: New Adventures in Higher-Order Automation - PuppetConf 2013 by Puppet
PuppetDB: New Adventures in Higher-Order Automation - PuppetConf 2013PuppetDB: New Adventures in Higher-Order Automation - PuppetConf 2013
PuppetDB: New Adventures in Higher-Order Automation - PuppetConf 2013
Puppet7.5K views
Basic command for linux by gt0ne
Basic command for linuxBasic command for linux
Basic command for linux
gt0ne705 views
Unix Commands by Dr.Ravi
Unix CommandsUnix Commands
Unix Commands
Dr.Ravi328 views
Python and rust 2018 pythonkorea jihun by JIHUN KIM
Python and rust 2018 pythonkorea jihunPython and rust 2018 pythonkorea jihun
Python and rust 2018 pythonkorea jihun
JIHUN KIM62 views
ch8-pv1-the-virtual-filesystem by yushiang fu
ch8-pv1-the-virtual-filesystemch8-pv1-the-virtual-filesystem
ch8-pv1-the-virtual-filesystem
yushiang fu288 views

Viewers also liked

Ruby and Twitter at the Ruby drink-up of Sophia, January 2013 by
Ruby and Twitter at the Ruby drink-up of Sophia, January 2013Ruby and Twitter at the Ruby drink-up of Sophia, January 2013
Ruby and Twitter at the Ruby drink-up of Sophia, January 2013rivierarb
1.5K views11 slides
Ruby object model at the Ruby drink-up of Sophia, January 2013 by
Ruby object model at the Ruby drink-up of Sophia, January 2013Ruby object model at the Ruby drink-up of Sophia, January 2013
Ruby object model at the Ruby drink-up of Sophia, January 2013rivierarb
1.4K views23 slides
Piloting processes through std IO at the Ruby Drink-up of Sophia, January 2012 by
Piloting processes through std IO at the Ruby Drink-up of Sophia, January 2012Piloting processes through std IO at the Ruby Drink-up of Sophia, January 2012
Piloting processes through std IO at the Ruby Drink-up of Sophia, January 2012rivierarb
1.8K views23 slides
Ruby C extensions at the Ruby drink-up of Sophia, April 2012 by
Ruby C extensions at the Ruby drink-up of Sophia, April 2012Ruby C extensions at the Ruby drink-up of Sophia, April 2012
Ruby C extensions at the Ruby drink-up of Sophia, April 2012rivierarb
2.4K views35 slides
DRb at the Ruby Drink-up of Sophia, December 2011 by
DRb at the Ruby Drink-up of Sophia, December 2011DRb at the Ruby Drink-up of Sophia, December 2011
DRb at the Ruby Drink-up of Sophia, December 2011rivierarb
1.2K views17 slides
Ruby and Docker on Rails by
Ruby and Docker on RailsRuby and Docker on Rails
Ruby and Docker on RailsMuriel Salvan
6.3K views62 slides

Viewers also liked(10)

Ruby and Twitter at the Ruby drink-up of Sophia, January 2013 by rivierarb
Ruby and Twitter at the Ruby drink-up of Sophia, January 2013Ruby and Twitter at the Ruby drink-up of Sophia, January 2013
Ruby and Twitter at the Ruby drink-up of Sophia, January 2013
rivierarb1.5K views
Ruby object model at the Ruby drink-up of Sophia, January 2013 by rivierarb
Ruby object model at the Ruby drink-up of Sophia, January 2013Ruby object model at the Ruby drink-up of Sophia, January 2013
Ruby object model at the Ruby drink-up of Sophia, January 2013
rivierarb1.4K views
Piloting processes through std IO at the Ruby Drink-up of Sophia, January 2012 by rivierarb
Piloting processes through std IO at the Ruby Drink-up of Sophia, January 2012Piloting processes through std IO at the Ruby Drink-up of Sophia, January 2012
Piloting processes through std IO at the Ruby Drink-up of Sophia, January 2012
rivierarb1.8K views
Ruby C extensions at the Ruby drink-up of Sophia, April 2012 by rivierarb
Ruby C extensions at the Ruby drink-up of Sophia, April 2012Ruby C extensions at the Ruby drink-up of Sophia, April 2012
Ruby C extensions at the Ruby drink-up of Sophia, April 2012
rivierarb2.4K views
DRb at the Ruby Drink-up of Sophia, December 2011 by rivierarb
DRb at the Ruby Drink-up of Sophia, December 2011DRb at the Ruby Drink-up of Sophia, December 2011
DRb at the Ruby Drink-up of Sophia, December 2011
rivierarb1.2K views
Ruby and Docker on Rails by Muriel Salvan
Ruby and Docker on RailsRuby and Docker on Rails
Ruby and Docker on Rails
Muriel Salvan6.3K views
Ruby 2.0 at the Ruby drink-up of Sophia, February 2013 by rivierarb
Ruby 2.0 at the Ruby drink-up of Sophia, February 2013Ruby 2.0 at the Ruby drink-up of Sophia, February 2013
Ruby 2.0 at the Ruby drink-up of Sophia, February 2013
rivierarb1.3K views
Quines—Programming your way back to where you were by Jean-Baptiste Mazon
Quines—Programming your way back to where you wereQuines—Programming your way back to where you were
Quines—Programming your way back to where you were

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

PyCon 2013 : Scripting to PyPi to GitHub and More by
PyCon 2013 : Scripting to PyPi to GitHub and MorePyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and MoreMatt Harrison
5.7K views191 slides
2.1.using the shell by
2.1.using the shell2.1.using the shell
2.1.using the shelldonv214
197 views17 slides
Red Hat Linux cheat sheet by
Red Hat Linux cheat sheetRed Hat Linux cheat sheet
Red Hat Linux cheat sheetRafael Montesinos Muñoz
397 views8 slides
Linux cheat sheet by
Linux cheat sheetLinux cheat sheet
Linux cheat sheetPinaki Mahata Mukherjee
1.5K views7 slides
Configuration surgery with Augeas (OggCamp 12) by
Configuration surgery with Augeas (OggCamp 12)Configuration surgery with Augeas (OggCamp 12)
Configuration surgery with Augeas (OggCamp 12)Dominic Cleal
5.5K views13 slides
Exploring Code with Pry! by
Exploring Code with Pry!Exploring Code with Pry!
Exploring Code with Pry!Clayton Parker
730 views30 slides

Similar to Pry at the Ruby Drink-up of Sophia, February 2012(20)

PyCon 2013 : Scripting to PyPi to GitHub and More by Matt Harrison
PyCon 2013 : Scripting to PyPi to GitHub and MorePyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and More
Matt Harrison5.7K views
2.1.using the shell by donv214
2.1.using the shell2.1.using the shell
2.1.using the shell
donv214197 views
Configuration surgery with Augeas (OggCamp 12) by Dominic Cleal
Configuration surgery with Augeas (OggCamp 12)Configuration surgery with Augeas (OggCamp 12)
Configuration surgery with Augeas (OggCamp 12)
Dominic Cleal5.5K views
An Introduction to User Space Filesystem Development by Matt Turner
An Introduction to User Space Filesystem DevelopmentAn Introduction to User Space Filesystem Development
An Introduction to User Space Filesystem Development
Matt Turner118 views
Linux Commandos Cheat by Alvaro Gomes
Linux Commandos CheatLinux Commandos Cheat
Linux Commandos Cheat
Alvaro Gomes243 views
Installing odoo v8 from github by Antony Gitomeh
Installing odoo v8 from githubInstalling odoo v8 from github
Installing odoo v8 from github
Antony Gitomeh5.5K views
Linux commands cheat sheet by linoxide.com by Stavros Skamagkis
Linux commands cheat sheet by linoxide.comLinux commands cheat sheet by linoxide.com
Linux commands cheat sheet by linoxide.com
Stavros Skamagkis240 views
Performance testing of microservices in Action by Alexander Kachur
Performance testing of microservices in ActionPerformance testing of microservices in Action
Performance testing of microservices in Action
Alexander Kachur885 views
Linux Basic Commands by Hanan Nmr
Linux Basic CommandsLinux Basic Commands
Linux Basic Commands
Hanan Nmr3.5K views
Basic shell commands by Jeremy Sanders by Devanand Gehlot
Basic shell commands by Jeremy SandersBasic shell commands by Jeremy Sanders
Basic shell commands by Jeremy Sanders
Devanand Gehlot63 views
Groovy on the Shell by sascha_klein
Groovy on the ShellGroovy on the Shell
Groovy on the Shell
sascha_klein5.8K views
Debugging Ruby (with Pry) by LukeBergen
Debugging Ruby (with Pry)Debugging Ruby (with Pry)
Debugging Ruby (with Pry)
LukeBergen4.2K views

Recently uploaded

Uni Systems for Power Platform.pptx by
Uni Systems for Power Platform.pptxUni Systems for Power Platform.pptx
Uni Systems for Power Platform.pptxUni Systems S.M.S.A.
50 views21 slides
The details of description: Techniques, tips, and tangents on alternative tex... by
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...BookNet Canada
121 views24 slides
Voice Logger - Telephony Integration Solution at Aegis by
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at AegisNirmal Sharma
17 views1 slide
Black and White Modern Science Presentation.pptx by
Black and White Modern Science Presentation.pptxBlack and White Modern Science Presentation.pptx
Black and White Modern Science Presentation.pptxmaryamkhalid2916
14 views21 slides
handbook for web 3 adoption.pdf by
handbook for web 3 adoption.pdfhandbook for web 3 adoption.pdf
handbook for web 3 adoption.pdfLiveplex
19 views16 slides
Perth MeetUp November 2023 by
Perth MeetUp November 2023 Perth MeetUp November 2023
Perth MeetUp November 2023 Michael Price
15 views44 slides

Recently uploaded(20)

The details of description: Techniques, tips, and tangents on alternative tex... by BookNet Canada
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...
BookNet Canada121 views
Voice Logger - Telephony Integration Solution at Aegis by Nirmal Sharma
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at Aegis
Nirmal Sharma17 views
Black and White Modern Science Presentation.pptx by maryamkhalid2916
Black and White Modern Science Presentation.pptxBlack and White Modern Science Presentation.pptx
Black and White Modern Science Presentation.pptx
maryamkhalid291614 views
handbook for web 3 adoption.pdf by Liveplex
handbook for web 3 adoption.pdfhandbook for web 3 adoption.pdf
handbook for web 3 adoption.pdf
Liveplex19 views
Perth MeetUp November 2023 by Michael Price
Perth MeetUp November 2023 Perth MeetUp November 2023
Perth MeetUp November 2023
Michael Price15 views
Data-centric AI and the convergence of data and model engineering: opportunit... by Paolo Missier
Data-centric AI and the convergence of data and model engineering:opportunit...Data-centric AI and the convergence of data and model engineering:opportunit...
Data-centric AI and the convergence of data and model engineering: opportunit...
Paolo Missier34 views
.conf Go 2023 - Data analysis as a routine by Splunk
.conf Go 2023 - Data analysis as a routine.conf Go 2023 - Data analysis as a routine
.conf Go 2023 - Data analysis as a routine
Splunk93 views
The Importance of Cybersecurity for Digital Transformation by NUS-ISS
The Importance of Cybersecurity for Digital TransformationThe Importance of Cybersecurity for Digital Transformation
The Importance of Cybersecurity for Digital Transformation
NUS-ISS27 views
Empathic Computing: Delivering the Potential of the Metaverse by Mark Billinghurst
Empathic Computing: Delivering  the Potential of the MetaverseEmpathic Computing: Delivering  the Potential of the Metaverse
Empathic Computing: Delivering the Potential of the Metaverse
Mark Billinghurst470 views
STPI OctaNE CoE Brochure.pdf by madhurjyapb
STPI OctaNE CoE Brochure.pdfSTPI OctaNE CoE Brochure.pdf
STPI OctaNE CoE Brochure.pdf
madhurjyapb12 views
DALI Basics Course 2023 by Ivory Egg
DALI Basics Course  2023DALI Basics Course  2023
DALI Basics Course 2023
Ivory Egg14 views
Five Things You SHOULD Know About Postman by Postman
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About Postman
Postman27 views
Business Analyst Series 2023 - Week 3 Session 5 by DianaGray10
Business Analyst Series 2023 -  Week 3 Session 5Business Analyst Series 2023 -  Week 3 Session 5
Business Analyst Series 2023 - Week 3 Session 5
DianaGray10209 views

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

  • 1. A quick overview Philippe Antras @_philant_
  • 2. Pry REPL Can be invoked at runtime Object exploration Source and documentation access Shell command execution Gist integration - not shown today Syntax highlighting, completion Extensible: plugin, commands - not shown today Remote session with pry-remote gem and DrB http://pry.github.com
  • 4. Some Pry commands To get a list of all commands: Pry(main)> help show-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 commands Pry assumes commands prefixed with a dot are shell commands pry(main)> .ls -l pry(main)> .svn update pry(main)> .cat #{temp_file} pry(main)> shell-mode #limited completion
  • 7. Object exploration pry(main)> pry-version Pry version 0.9.7.4 on Ruby 1.8.7 pry(main)> cd Pry pry(Pry)> ls pry(Pry)> cd @history pry(Pry)> ls -m pry(Pry)> show-doc save pry(Pry)> show-method save pry(Pry)> filename = 'history' pry(Pry)> save filename pry(Pry)> .cat #{filename} pry(Pry)> cd @history pry(Pry::History)> p size pry(Pry::History)> puts size pry(Pry::History)> nesting pry(Pry::History)> cd ../.. pry(main)
  • 8. debugging with Pry runtime invocation binding.pry <object>.pry whereami
  • 9. Documentation and source browsing install the pry-doc plugin: > gem install pry-doc pry(main)> a = [1, 2, 3] pry(main)> ls a -m pry(main)> show-doc a.nitems pry(main)> ls Array -M pry(main)> show-doc Array#shelljoin pry(main)> show-method Array#shelljoin
  • 10. Pry as rails console 1. gemfile: gem "pry", :group => :development 2. bundle install 3. config/environment/development.rb silence_warnings do require "pry" IRB = Pry end 4. rails console pry(main)>
  • 11. Pry customization ~/.pryrc and ./.pryrc files Pry.config.input Pry.config.prompt Pry.config.output Pry.config.print Pry.config.exception_handler Pry.config.color Pry.config.pager
  • 12. Room for improvement Pry 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