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

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)

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
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
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
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
 
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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

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