SlideShare a Scribd company logo
1 of 13
Download to read offline
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.

More Related Content

What's hot

자바스터디 4
자바스터디 4자바스터디 4
자바스터디 4
jangpd007
 
Python utan-stodhjul-motorsag
Python utan-stodhjul-motorsagPython utan-stodhjul-motorsag
Python utan-stodhjul-motorsag
niklal
 
Instalasi Network Monitoring System (Nagios) Ubuntu 12.04
Instalasi Network Monitoring System (Nagios) Ubuntu 12.04Instalasi Network Monitoring System (Nagios) Ubuntu 12.04
Instalasi Network Monitoring System (Nagios) Ubuntu 12.04
Febi Gelar Ramadhan
 
Gitosis on Mac OS X Server
Gitosis on Mac OS X ServerGitosis on Mac OS X Server
Gitosis on Mac OS X Server
Yasuhiro Asaka
 
Basic command for linux
Basic command for linuxBasic command for linux
Basic command for linux
gt0ne
 
Unix Commands
Unix CommandsUnix Commands
Unix Commands
Dr.Ravi
 
ch8-pv1-the-virtual-filesystem
ch8-pv1-the-virtual-filesystemch8-pv1-the-virtual-filesystem
ch8-pv1-the-virtual-filesystem
yushiang fu
 

What's hot (20)

자바스터디 4
자바스터디 4자바스터디 4
자바스터디 4
 
Python utan-stodhjul-motorsag
Python utan-stodhjul-motorsagPython utan-stodhjul-motorsag
Python utan-stodhjul-motorsag
 
Instalasi Network Monitoring System (Nagios) Ubuntu 12.04
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
Стажировка 2016-07-27 02 Денис Нелюбин. PostgreSQL и jsonbСтажировка 2016-07-27 02 Денис Нелюбин. PostgreSQL и jsonb
Стажировка 2016-07-27 02 Денис Нелюбин. PostgreSQL и jsonb
 
Goの標準的な開発の流れ
Goの標準的な開発の流れGoの標準的な開発の流れ
Goの標準的な開発の流れ
 
How Secure Are Docker Containers?
How Secure Are Docker Containers?How Secure Are Docker Containers?
How Secure Are Docker Containers?
 
CentOS_slide_ver1.0
CentOS_slide_ver1.0CentOS_slide_ver1.0
CentOS_slide_ver1.0
 
Redis, Resque & Friends
Redis, Resque & FriendsRedis, Resque & Friends
Redis, Resque & Friends
 
Using Puppet to Create a Dynamic Network - PuppetConf 2013
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
 
Using the Power to Prove
Using the Power to ProveUsing the Power to Prove
Using the Power to Prove
 
Serializing Ruby Objects in Redis
Serializing Ruby Objects in RedisSerializing Ruby Objects in Redis
Serializing Ruby Objects in Redis
 
Linux cheat-sheet
Linux cheat-sheetLinux cheat-sheet
Linux cheat-sheet
 
Gitosis on Mac OS X Server
Gitosis on Mac OS X ServerGitosis on Mac OS X Server
Gitosis on Mac OS X Server
 
Linux Basics
Linux BasicsLinux Basics
Linux Basics
 
PuppetDB: New Adventures in Higher-Order Automation - PuppetConf 2013
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
 
Basic command for linux
Basic command for linuxBasic command for linux
Basic command for linux
 
Unix Commands
Unix CommandsUnix Commands
Unix Commands
 
TCP/IP Exercises
TCP/IP ExercisesTCP/IP Exercises
TCP/IP Exercises
 
Python and rust 2018 pythonkorea jihun
Python and rust 2018 pythonkorea jihunPython and rust 2018 pythonkorea jihun
Python and rust 2018 pythonkorea jihun
 
ch8-pv1-the-virtual-filesystem
ch8-pv1-the-virtual-filesystemch8-pv1-the-virtual-filesystem
ch8-pv1-the-virtual-filesystem
 

Viewers also liked

Viewers also liked (10)

Ruby and Twitter at the Ruby drink-up of Sophia, January 2013
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
 
Ruby object model at the Ruby drink-up of Sophia, January 2013
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
 
Piloting 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 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
 
Ruby C extensions at the Ruby drink-up of Sophia, April 2012
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
 
DRb at the Ruby Drink-up of Sophia, December 2011
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
 
Ruby and Docker on Rails
Ruby and Docker on RailsRuby and Docker on Rails
Ruby and Docker on Rails
 
Ruby 2.0 at the Ruby drink-up of Sophia, February 2013
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
 
Untitled talk at Riviera.rb
Untitled talk at Riviera.rbUntitled talk at Riviera.rb
Untitled talk at Riviera.rb
 
The Dark Side of Programming Languages
The Dark Side of Programming LanguagesThe Dark Side of Programming Languages
The Dark Side of Programming Languages
 
Quines—Programming your way back to where you were
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
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 Harrison
 
2.1.using the shell
2.1.using the shell2.1.using the shell
2.1.using the shell
donv214
 

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

PyCon 2013 : Scripting to PyPi to GitHub and More
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
 
2.1.using the shell
2.1.using the shell2.1.using the shell
2.1.using the shell
 
Red Hat Linux cheat sheet
Red Hat Linux cheat sheetRed Hat Linux cheat sheet
Red Hat Linux cheat sheet
 
Linux cheat sheet
Linux cheat sheetLinux cheat sheet
Linux cheat sheet
 
Configuration surgery with Augeas (OggCamp 12)
Configuration surgery with Augeas (OggCamp 12)Configuration surgery with Augeas (OggCamp 12)
Configuration surgery with Augeas (OggCamp 12)
 
Exploring Code with Pry!
Exploring Code with Pry!Exploring Code with Pry!
Exploring Code with Pry!
 
Unix / Linux Command Reference
Unix / Linux Command ReferenceUnix / Linux Command Reference
Unix / Linux Command Reference
 
An Introduction to User Space Filesystem Development
An Introduction to User Space Filesystem DevelopmentAn Introduction to User Space Filesystem Development
An Introduction to User Space Filesystem Development
 
Linux Commandos Cheat
Linux Commandos CheatLinux Commandos Cheat
Linux Commandos Cheat
 
Linux cheat-sheet
Linux cheat-sheetLinux cheat-sheet
Linux cheat-sheet
 
Installing odoo v8 from github
Installing odoo v8 from githubInstalling odoo v8 from github
Installing odoo v8 from github
 
Linux audit framework
Linux audit frameworkLinux audit framework
Linux audit framework
 
Linux commands cheat sheet by linoxide.com
Linux commands cheat sheet by linoxide.comLinux commands cheat sheet by linoxide.com
Linux commands cheat sheet by linoxide.com
 
Python build your security tools.pdf
Python build your security tools.pdfPython build your security tools.pdf
Python build your security tools.pdf
 
14.Linux Command
14.Linux Command14.Linux Command
14.Linux Command
 
Performance testing of microservices in Action
Performance testing of microservices in ActionPerformance testing of microservices in Action
Performance testing of microservices in Action
 
Linux Basic Commands
Linux Basic CommandsLinux Basic Commands
Linux Basic Commands
 
Basic shell commands by Jeremy Sanders
Basic shell commands by Jeremy SandersBasic shell commands by Jeremy Sanders
Basic shell commands by Jeremy Sanders
 
Groovy on the Shell
Groovy on the ShellGroovy on the Shell
Groovy on the Shell
 
Debugging Ruby (with Pry)
Debugging Ruby (with Pry)Debugging Ruby (with Pry)
Debugging Ruby (with Pry)
 

Recently uploaded

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 

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