SlideShare a Scribd company logo
Debugging with pry
❤
Murilo Capanema - 2015
Who Am I?
GitHub: mcapanema
BankFacil (We are Hiring!)
Murilo Capanema - 2015
What is pry ?
Pry is a powerful alternative to the standard IRB shell
for Ruby.
Murilo Capanema - 2015
Why pry ?
Features:
4 syntax highlighting;
4 flexible plugin architecture;
4 runtime invocation and source
and documentation browsing;
Murilo Capanema - 2015
Why not to use pry ?
Murilo Capanema - 2015
Murilo Capanema - 2015
What really is pry ?
One line of ruby:
def repl
loop{ puts eval $stdin.readline}
end
Murilo Capanema - 2015
A little bit of REPL
Read
Eval
Print
Loop
Murilo Capanema - 2015
A little bit of REPL
REPL with Tests
4 REPL first !;
4 Record what the code should do ";
4 Write a code that works first time #;
Murilo Capanema - 2015
Why REPL ?
REPL or Debugger Driven Development helps you to reach a code that works pretty quickly
Murilo Capanema - 2015
Backing to pry
require 'pry'
binding.pry
Murilo Capanema - 2015
Pry and his friends
4 pry-stack-explorer;
4 pry-debugger;
4 pry-rescue;
4 pry-doc;
4 pry-git;
4 help
Murilo Capanema - 2015
Pry magics
ls
[1] pry(main)> ls
self.methods: inspect to_s
locals: _ __ _dir_ _ex_ _file_ _in_ _out_ _pry_
[2] pry(main)>
Murilo Capanema - 2015
Pry magics
ls
[1] pry(main)> ls Kernel
constants: RUBYGEMS_ACTIVATION_MONITOR
Kernel.methods:
Array Rational abort block_given? exit global_variables open putc require sprintf trace_var
Complex String ap caller exit! iterator? p puts require_relative srand trap
Float __callee__ at_exit caller_locations fail lambda pp raise select syscall untrace_var
Hash __dir__ autoload catch fork load print rand set_trace_func system warn
Integer __method__ autoload? eval format local_variables printf readline sleep test
Pathname ` binding exec gets loop proc readlines spawn throw
Kernel#methods:
!~ clone frozen? kind_of? public_methods tainted?
<=> debugger hash method public_send tap
=== define_singleton_method inspect methods remove_instance_variable to_enum
=~ display instance_of? nil? respond_to? to_s
ai dup instance_variable_defined? object_id send trust
awesome_inspect enum_for instance_variable_get pretty_inspect singleton_class untaint
awesome_print eql? instance_variable_set private_methods singleton_method untrust
byebug extend instance_variables protected_methods singleton_methods untrusted?
class freeze is_a? public_method taint
[2] pry(main)>
Murilo Capanema - 2015
Pry magics
$ - show-source
[1] pry(main)> $ Kernel#puts
From: io.c (C Method):
Owner: Kernel
Visibility: private
Number of lines: 8
static VALUE
rb_f_puts(argc, argv)
int argc;
VALUE *argv;
{
rb_io_puts(argc, argv, rb_stdout);
return Qnil;
}
[2] pry(main)>
Murilo Capanema - 2015
Pry magics
$ - show-source
[1] pry(main)> $ Hash
From: /home/vagrant/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/pp.rb @ line 369:
Class name: Hash
Number of lines: 9
class Hash # :nodoc:
def pretty_print(q) # :nodoc:
q.pp_hash self
end
def pretty_print_cycle(q) # :nodoc:
q.text(empty? ? '{}' : '{...}')
end
end
[2] pry(main)>
Murilo Capanema - 2015
Pry magics
? - show-doc
[1] pry(main)> ? Object
From: /home/vagrant/.rvm/gems/ruby-2.1.3/gems/awesome_print-1.2.0/lib/awesome_print/core_ext/object.rb @ line 1:
Class name: Object
Number of monkeypatches: 6. Use the `-a` option to display all available monkeypatches
Number of lines: 5
...
...
...
[2] pry(main)>
Murilo Capanema - 2015
Pry magics
break
[1] pry(main)> break method_name
Breakpoint 1: /path/to/file.rb @ line 1 (Enabled):
...
...
...
[2] pry(main)>
Murilo Capanema - 2015
Pry magics
try-again
[1] pry(main)> try-again
[2] pry(main)>
Murilo Capanema - 2015
Pry magics
step/next
[1] pry(main)> step
[2] pry(main)> next
Murilo Capanema - 2015
Pry magics
play
[1] pry(main)> play -l 1
[2] pry(main)>
Murilo Capanema - 2015
Pry magics
edit [OPTIONS]
4 -e Open editor on last exception raised
4 -m Open editor on a given method
4 -c Open editor on current method
[1] pry(main)> edit -m method_name
[2] pry(main)>
Murilo Capanema - 2015
Pry magics
up
[1] pry(main)> up
[2] pry(main)>
Murilo Capanema - 2015
Pry magics
down
[1] pry(main)> down
[2] pry(main)>
Murilo Capanema - 2015
Pry magics
@ - whereami
[1] pry(Kernel):1> cd Kernel#puts
[2] pry(Kernel):2> @
Inside Kernel.
[3] pry(Kernel):2>
Murilo Capanema - 2015
Debugging
4 Reproduce locally;
4 Find the problem;
4 Fix it;
Murilo Capanema - 2015
More pry magics
wtf - _ex_.backtrace
[1] pry(Kernel):1> wtf?
...
...
...
[2] pry(Kernel):2>
Murilo Capanema - 2015
Further Reading
https://www.youtube.com/watch?v=D9j_Mf91M0I
https://www.youtube.com/watch?v=4hfMUP5iTq8
https://github.com/nixme/jazz_hands
http://pryrepl.org/
Murilo Capanema - 2015
Fin
GitHub: mcapanema
Seriously We are Hiring!
Murilo Capanema - 2015

More Related Content

What's hot

OSDC 2014: Ole Michaelis & Sönke Rümpler: Make it SOLID - Software Architectu...
OSDC 2014: Ole Michaelis & Sönke Rümpler: Make it SOLID - Software Architectu...OSDC 2014: Ole Michaelis & Sönke Rümpler: Make it SOLID - Software Architectu...
OSDC 2014: Ole Michaelis & Sönke Rümpler: Make it SOLID - Software Architectu...
NETWAYS
 
Metasepi team meeting #14: ATS programming on MCU
Metasepi team meeting #14: ATS programming on MCUMetasepi team meeting #14: ATS programming on MCU
Metasepi team meeting #14: ATS programming on MCU
Kiwamu Okabe
 
Development Principles & Philosophy
Development Principles & PhilosophyDevelopment Principles & Philosophy
Development Principles & Philosophy
François-Guillaume Ribreau
 
Php Extensions for Dummies
Php Extensions for DummiesPhp Extensions for Dummies
Php Extensions for Dummies
Elizabeth Smith
 
Metasepi team meeting #16: Safety on ATS language + MCU
Metasepi team meeting #16: Safety on ATS language + MCUMetasepi team meeting #16: Safety on ATS language + MCU
Metasepi team meeting #16: Safety on ATS language + MCU
Kiwamu Okabe
 
Real-time OS system state captured by ATS language
Real-time OS system state captured by ATS languageReal-time OS system state captured by ATS language
Real-time OS system state captured by ATS language
Kiwamu Okabe
 
Start! ATS programming
Start! ATS programmingStart! ATS programming
Start! ATS programming
Kiwamu Okabe
 
Embedded application designed by ATS language
Embedded application designed by ATS languageEmbedded application designed by ATS language
Embedded application designed by ATS language
Kiwamu Okabe
 
Fasterflect
FasterflectFasterflect
Fasterflect
Buu Nguyen
 
Better rspec 進擊的 RSpec
Better rspec 進擊的 RSpecBetter rspec 進擊的 RSpec
Better rspec 進擊的 RSpec
Li Hsuan Hung
 
March2004-CPerlRun
March2004-CPerlRunMarch2004-CPerlRun
March2004-CPerlRun
tutorialsruby
 
Diving into HHVM Extensions (php[tek] 2016)
Diving into HHVM Extensions (php[tek] 2016)Diving into HHVM Extensions (php[tek] 2016)
Diving into HHVM Extensions (php[tek] 2016)
James Titcumb
 
ATS Programming Tutorial
ATS Programming TutorialATS Programming Tutorial
ATS Programming Tutorial
Kiwamu Okabe
 
Create your own PHP extension, step by step - phpDay 2012 Verona
Create your own PHP extension, step by step - phpDay 2012 VeronaCreate your own PHP extension, step by step - phpDay 2012 Verona
Create your own PHP extension, step by step - phpDay 2012 Verona
Patrick Allaert
 
Adding 1.21 Gigawatts to Applications with RabbitMQ (PHP Oxford June Meetup 2...
Adding 1.21 Gigawatts to Applications with RabbitMQ (PHP Oxford June Meetup 2...Adding 1.21 Gigawatts to Applications with RabbitMQ (PHP Oxford June Meetup 2...
Adding 1.21 Gigawatts to Applications with RabbitMQ (PHP Oxford June Meetup 2...
James Titcumb
 
Implementing pattern-matching in JavaScript (short version)
Implementing pattern-matching in JavaScript (short version)Implementing pattern-matching in JavaScript (short version)
Implementing pattern-matching in JavaScript (short version)
François-Guillaume Ribreau
 
Rust & Gamedev
Rust & GamedevRust & Gamedev
Rust & Gamedev
Giorgio Pomettini
 
Meetup di Gruppo Game Jam Roma - Giorgio Pomettini - Codemotion Rome 2018
Meetup di Gruppo Game Jam Roma - Giorgio Pomettini - Codemotion Rome 2018Meetup di Gruppo Game Jam Roma - Giorgio Pomettini - Codemotion Rome 2018
Meetup di Gruppo Game Jam Roma - Giorgio Pomettini - Codemotion Rome 2018
Codemotion
 

What's hot (18)

OSDC 2014: Ole Michaelis & Sönke Rümpler: Make it SOLID - Software Architectu...
OSDC 2014: Ole Michaelis & Sönke Rümpler: Make it SOLID - Software Architectu...OSDC 2014: Ole Michaelis & Sönke Rümpler: Make it SOLID - Software Architectu...
OSDC 2014: Ole Michaelis & Sönke Rümpler: Make it SOLID - Software Architectu...
 
Metasepi team meeting #14: ATS programming on MCU
Metasepi team meeting #14: ATS programming on MCUMetasepi team meeting #14: ATS programming on MCU
Metasepi team meeting #14: ATS programming on MCU
 
Development Principles & Philosophy
Development Principles & PhilosophyDevelopment Principles & Philosophy
Development Principles & Philosophy
 
Php Extensions for Dummies
Php Extensions for DummiesPhp Extensions for Dummies
Php Extensions for Dummies
 
Metasepi team meeting #16: Safety on ATS language + MCU
Metasepi team meeting #16: Safety on ATS language + MCUMetasepi team meeting #16: Safety on ATS language + MCU
Metasepi team meeting #16: Safety on ATS language + MCU
 
Real-time OS system state captured by ATS language
Real-time OS system state captured by ATS languageReal-time OS system state captured by ATS language
Real-time OS system state captured by ATS language
 
Start! ATS programming
Start! ATS programmingStart! ATS programming
Start! ATS programming
 
Embedded application designed by ATS language
Embedded application designed by ATS languageEmbedded application designed by ATS language
Embedded application designed by ATS language
 
Fasterflect
FasterflectFasterflect
Fasterflect
 
Better rspec 進擊的 RSpec
Better rspec 進擊的 RSpecBetter rspec 進擊的 RSpec
Better rspec 進擊的 RSpec
 
March2004-CPerlRun
March2004-CPerlRunMarch2004-CPerlRun
March2004-CPerlRun
 
Diving into HHVM Extensions (php[tek] 2016)
Diving into HHVM Extensions (php[tek] 2016)Diving into HHVM Extensions (php[tek] 2016)
Diving into HHVM Extensions (php[tek] 2016)
 
ATS Programming Tutorial
ATS Programming TutorialATS Programming Tutorial
ATS Programming Tutorial
 
Create your own PHP extension, step by step - phpDay 2012 Verona
Create your own PHP extension, step by step - phpDay 2012 VeronaCreate your own PHP extension, step by step - phpDay 2012 Verona
Create your own PHP extension, step by step - phpDay 2012 Verona
 
Adding 1.21 Gigawatts to Applications with RabbitMQ (PHP Oxford June Meetup 2...
Adding 1.21 Gigawatts to Applications with RabbitMQ (PHP Oxford June Meetup 2...Adding 1.21 Gigawatts to Applications with RabbitMQ (PHP Oxford June Meetup 2...
Adding 1.21 Gigawatts to Applications with RabbitMQ (PHP Oxford June Meetup 2...
 
Implementing pattern-matching in JavaScript (short version)
Implementing pattern-matching in JavaScript (short version)Implementing pattern-matching in JavaScript (short version)
Implementing pattern-matching in JavaScript (short version)
 
Rust & Gamedev
Rust & GamedevRust & Gamedev
Rust & Gamedev
 
Meetup di Gruppo Game Jam Roma - Giorgio Pomettini - Codemotion Rome 2018
Meetup di Gruppo Game Jam Roma - Giorgio Pomettini - Codemotion Rome 2018Meetup di Gruppo Game Jam Roma - Giorgio Pomettini - Codemotion Rome 2018
Meetup di Gruppo Game Jam Roma - Giorgio Pomettini - Codemotion Rome 2018
 

Viewers also liked

Jurassic JavaScript Park - Rodando Offline até na ilha Nublar!
Jurassic JavaScript Park - Rodando Offline até na ilha Nublar!Jurassic JavaScript Park - Rodando Offline até na ilha Nublar!
Jurassic JavaScript Park - Rodando Offline até na ilha Nublar!
Creditas
 
How To Get Organized
How To Get OrganizedHow To Get Organized
How To Get Organized
Creditas
 
A arte de ser Mensch
A arte de ser MenschA arte de ser Mensch
A arte de ser Mensch
Creditas
 
Rails in the bowels
Rails in the bowelsRails in the bowels
Rails in the bowels
Creditas
 
Positive reinforcement and statistics
Positive reinforcement and statisticsPositive reinforcement and statistics
Positive reinforcement and statistics
Creditas
 
O que o seu texto diz sobre você
O que o seu texto diz sobre vocêO que o seu texto diz sobre você
O que o seu texto diz sobre você
Creditas
 
O paradoxo da escolha
O paradoxo da escolhaO paradoxo da escolha
O paradoxo da escolha
Creditas
 
Modern sql
Modern sqlModern sql
Modern sql
Creditas
 
Sublime
SublimeSublime
Sublime
Creditas
 
Text mining Pre-processing
Text mining Pre-processingText mining Pre-processing
Text mining Pre-processing
Creditas
 
OOCSS and SMACSS
OOCSS and SMACSSOOCSS and SMACSS
OOCSS and SMACSS
Creditas
 
An introduction to MySQL
An introduction to MySQLAn introduction to MySQL
An introduction to MySQL
Creditas
 
Como melhorar sua comunicação com sua equipe, sua mãe e seu chefe
Como melhorar sua comunicação com sua equipe, sua mãe e seu chefeComo melhorar sua comunicação com sua equipe, sua mãe e seu chefe
Como melhorar sua comunicação com sua equipe, sua mãe e seu chefe
Creditas
 
Pig - Analyzing data sets
Pig - Analyzing data setsPig - Analyzing data sets
Pig - Analyzing data sets
Creditas
 
Melanoma: how to detect skin cancer
Melanoma: how to detect skin cancerMelanoma: how to detect skin cancer
Melanoma: how to detect skin cancer
Creditas
 

Viewers also liked (15)

Jurassic JavaScript Park - Rodando Offline até na ilha Nublar!
Jurassic JavaScript Park - Rodando Offline até na ilha Nublar!Jurassic JavaScript Park - Rodando Offline até na ilha Nublar!
Jurassic JavaScript Park - Rodando Offline até na ilha Nublar!
 
How To Get Organized
How To Get OrganizedHow To Get Organized
How To Get Organized
 
A arte de ser Mensch
A arte de ser MenschA arte de ser Mensch
A arte de ser Mensch
 
Rails in the bowels
Rails in the bowelsRails in the bowels
Rails in the bowels
 
Positive reinforcement and statistics
Positive reinforcement and statisticsPositive reinforcement and statistics
Positive reinforcement and statistics
 
O que o seu texto diz sobre você
O que o seu texto diz sobre vocêO que o seu texto diz sobre você
O que o seu texto diz sobre você
 
O paradoxo da escolha
O paradoxo da escolhaO paradoxo da escolha
O paradoxo da escolha
 
Modern sql
Modern sqlModern sql
Modern sql
 
Sublime
SublimeSublime
Sublime
 
Text mining Pre-processing
Text mining Pre-processingText mining Pre-processing
Text mining Pre-processing
 
OOCSS and SMACSS
OOCSS and SMACSSOOCSS and SMACSS
OOCSS and SMACSS
 
An introduction to MySQL
An introduction to MySQLAn introduction to MySQL
An introduction to MySQL
 
Como melhorar sua comunicação com sua equipe, sua mãe e seu chefe
Como melhorar sua comunicação com sua equipe, sua mãe e seu chefeComo melhorar sua comunicação com sua equipe, sua mãe e seu chefe
Como melhorar sua comunicação com sua equipe, sua mãe e seu chefe
 
Pig - Analyzing data sets
Pig - Analyzing data setsPig - Analyzing data sets
Pig - Analyzing data sets
 
Melanoma: how to detect skin cancer
Melanoma: how to detect skin cancerMelanoma: how to detect skin cancer
Melanoma: how to detect skin cancer
 

Similar to Debugging with pry

Head in the Clouds: Testing Infra as Code - Config Management 2020
Head in the Clouds: Testing Infra as Code - Config Management 2020Head in the Clouds: Testing Infra as Code - Config Management 2020
Head in the Clouds: Testing Infra as Code - Config Management 2020
Peter Souter
 
Introduction to Writing Readable and Maintainable Perl (YAPC::EU 2011 Version)
Introduction to Writing Readable and Maintainable Perl (YAPC::EU 2011 Version)Introduction to Writing Readable and Maintainable Perl (YAPC::EU 2011 Version)
Introduction to Writing Readable and Maintainable Perl (YAPC::EU 2011 Version)
Alex Balhatchet
 
Defcon 22 - Stitching numbers - generating rop payloads from in memory numbers
Defcon 22 - Stitching numbers - generating rop payloads from in memory numbersDefcon 22 - Stitching numbers - generating rop payloads from in memory numbers
Defcon 22 - Stitching numbers - generating rop payloads from in memory numbers
Alexandre Moneger
 
Power of linked list
Power of linked listPower of linked list
Power of linked list
Peter Hlavaty
 
05 - Bypassing DEP, or why ASLR matters
05 - Bypassing DEP, or why ASLR matters05 - Bypassing DEP, or why ASLR matters
05 - Bypassing DEP, or why ASLR matters
Alexandre Moneger
 
2014-08-19 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Chicago
2014-08-19 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Chicago2014-08-19 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Chicago
2014-08-19 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Chicago
garrett honeycutt
 
Euro python2011 High Performance Python
Euro python2011 High Performance PythonEuro python2011 High Performance Python
Euro python2011 High Performance Python
Ian Ozsvald
 
2014-11-11 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Seattle
2014-11-11 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Seattle2014-11-11 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Seattle
2014-11-11 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Seattle
garrett honeycutt
 
Securing your Rails application
Securing your Rails applicationSecuring your Rails application
Securing your Rails application
clucasKrof
 
Secure Programming Practices in C++ (NDC Oslo 2018)
Secure Programming Practices in C++ (NDC Oslo 2018)Secure Programming Practices in C++ (NDC Oslo 2018)
Secure Programming Practices in C++ (NDC Oslo 2018)
Patricia Aas
 
Practical Pig and PigUnit (Michael Noll, Verisign)
Practical Pig and PigUnit (Michael Noll, Verisign)Practical Pig and PigUnit (Michael Noll, Verisign)
Practical Pig and PigUnit (Michael Noll, Verisign)
Swiss Big Data User Group
 
C++ Core Guidelines
C++ Core GuidelinesC++ Core Guidelines
C++ Core Guidelines
Thomas Pollak
 
Pipfile, pipenv, pip… what?!
Pipfile, pipenv, pip… what?!Pipfile, pipenv, pip… what?!
Pipfile, pipenv, pip… what?!
Ivan Chernoff
 
Pypy is-it-ready-for-production-the-sequel
Pypy is-it-ready-for-production-the-sequelPypy is-it-ready-for-production-the-sequel
Pypy is-it-ready-for-production-the-sequel
Mark Rees
 
Ruby - The Hard Bits
Ruby - The Hard BitsRuby - The Hard Bits
Ruby - The Hard Bits
Paul Gallagher
 
20140408 tdd puppetcamp-paris
20140408 tdd puppetcamp-paris20140408 tdd puppetcamp-paris
20140408 tdd puppetcamp-paris
Johan De Wit
 
Puppet Camp Paris 2014: Test Driven Development
Puppet Camp Paris 2014: Test Driven DevelopmentPuppet Camp Paris 2014: Test Driven Development
Puppet Camp Paris 2014: Test Driven Development
Puppet
 
March2004-CPerlRun
March2004-CPerlRunMarch2004-CPerlRun
March2004-CPerlRun
tutorialsruby
 
March2004-CPerlRun
March2004-CPerlRunMarch2004-CPerlRun
March2004-CPerlRun
tutorialsruby
 
March2004-CPerlRun
March2004-CPerlRunMarch2004-CPerlRun
March2004-CPerlRun
tutorialsruby
 

Similar to Debugging with pry (20)

Head in the Clouds: Testing Infra as Code - Config Management 2020
Head in the Clouds: Testing Infra as Code - Config Management 2020Head in the Clouds: Testing Infra as Code - Config Management 2020
Head in the Clouds: Testing Infra as Code - Config Management 2020
 
Introduction to Writing Readable and Maintainable Perl (YAPC::EU 2011 Version)
Introduction to Writing Readable and Maintainable Perl (YAPC::EU 2011 Version)Introduction to Writing Readable and Maintainable Perl (YAPC::EU 2011 Version)
Introduction to Writing Readable and Maintainable Perl (YAPC::EU 2011 Version)
 
Defcon 22 - Stitching numbers - generating rop payloads from in memory numbers
Defcon 22 - Stitching numbers - generating rop payloads from in memory numbersDefcon 22 - Stitching numbers - generating rop payloads from in memory numbers
Defcon 22 - Stitching numbers - generating rop payloads from in memory numbers
 
Power of linked list
Power of linked listPower of linked list
Power of linked list
 
05 - Bypassing DEP, or why ASLR matters
05 - Bypassing DEP, or why ASLR matters05 - Bypassing DEP, or why ASLR matters
05 - Bypassing DEP, or why ASLR matters
 
2014-08-19 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Chicago
2014-08-19 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Chicago2014-08-19 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Chicago
2014-08-19 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Chicago
 
Euro python2011 High Performance Python
Euro python2011 High Performance PythonEuro python2011 High Performance Python
Euro python2011 High Performance Python
 
2014-11-11 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Seattle
2014-11-11 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Seattle2014-11-11 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Seattle
2014-11-11 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Seattle
 
Securing your Rails application
Securing your Rails applicationSecuring your Rails application
Securing your Rails application
 
Secure Programming Practices in C++ (NDC Oslo 2018)
Secure Programming Practices in C++ (NDC Oslo 2018)Secure Programming Practices in C++ (NDC Oslo 2018)
Secure Programming Practices in C++ (NDC Oslo 2018)
 
Practical Pig and PigUnit (Michael Noll, Verisign)
Practical Pig and PigUnit (Michael Noll, Verisign)Practical Pig and PigUnit (Michael Noll, Verisign)
Practical Pig and PigUnit (Michael Noll, Verisign)
 
C++ Core Guidelines
C++ Core GuidelinesC++ Core Guidelines
C++ Core Guidelines
 
Pipfile, pipenv, pip… what?!
Pipfile, pipenv, pip… what?!Pipfile, pipenv, pip… what?!
Pipfile, pipenv, pip… what?!
 
Pypy is-it-ready-for-production-the-sequel
Pypy is-it-ready-for-production-the-sequelPypy is-it-ready-for-production-the-sequel
Pypy is-it-ready-for-production-the-sequel
 
Ruby - The Hard Bits
Ruby - The Hard BitsRuby - The Hard Bits
Ruby - The Hard Bits
 
20140408 tdd puppetcamp-paris
20140408 tdd puppetcamp-paris20140408 tdd puppetcamp-paris
20140408 tdd puppetcamp-paris
 
Puppet Camp Paris 2014: Test Driven Development
Puppet Camp Paris 2014: Test Driven DevelopmentPuppet Camp Paris 2014: Test Driven Development
Puppet Camp Paris 2014: Test Driven Development
 
March2004-CPerlRun
March2004-CPerlRunMarch2004-CPerlRun
March2004-CPerlRun
 
March2004-CPerlRun
March2004-CPerlRunMarch2004-CPerlRun
March2004-CPerlRun
 
March2004-CPerlRun
March2004-CPerlRunMarch2004-CPerlRun
March2004-CPerlRun
 

More from Creditas

Hanami & Domain-Driven Design
Hanami & Domain-Driven DesignHanami & Domain-Driven Design
Hanami & Domain-Driven Design
Creditas
 
Application layer
Application layerApplication layer
Application layer
Creditas
 
Hanami with a modern touch
Hanami with a modern touchHanami with a modern touch
Hanami with a modern touch
Creditas
 
Rails Girls - RubyConfBR 2015
Rails Girls - RubyConfBR 2015Rails Girls - RubyConfBR 2015
Rails Girls - RubyConfBR 2015
Creditas
 
GTD - Getting Things Done
GTD - Getting Things DoneGTD - Getting Things Done
GTD - Getting Things Done
Creditas
 
Neo4 j
Neo4 jNeo4 j
Neo4 j
Creditas
 
Learning how to learn
Learning how to learnLearning how to learn
Learning how to learn
Creditas
 
Solid - OOD Principles
Solid - OOD PrinciplesSolid - OOD Principles
Solid - OOD Principles
Creditas
 
Sistemas de recomendação em ruby
Sistemas de recomendação em rubySistemas de recomendação em ruby
Sistemas de recomendação em ruby
Creditas
 
Do MONOLÍTICO à arquitetura distribuída
Do MONOLÍTICO à arquitetura distribuídaDo MONOLÍTICO à arquitetura distribuída
Do MONOLÍTICO à arquitetura distribuída
Creditas
 
Minitest
MinitestMinitest
Minitest
Creditas
 
Deploy Heroku
Deploy HerokuDeploy Heroku
Deploy Heroku
Creditas
 

More from Creditas (12)

Hanami & Domain-Driven Design
Hanami & Domain-Driven DesignHanami & Domain-Driven Design
Hanami & Domain-Driven Design
 
Application layer
Application layerApplication layer
Application layer
 
Hanami with a modern touch
Hanami with a modern touchHanami with a modern touch
Hanami with a modern touch
 
Rails Girls - RubyConfBR 2015
Rails Girls - RubyConfBR 2015Rails Girls - RubyConfBR 2015
Rails Girls - RubyConfBR 2015
 
GTD - Getting Things Done
GTD - Getting Things DoneGTD - Getting Things Done
GTD - Getting Things Done
 
Neo4 j
Neo4 jNeo4 j
Neo4 j
 
Learning how to learn
Learning how to learnLearning how to learn
Learning how to learn
 
Solid - OOD Principles
Solid - OOD PrinciplesSolid - OOD Principles
Solid - OOD Principles
 
Sistemas de recomendação em ruby
Sistemas de recomendação em rubySistemas de recomendação em ruby
Sistemas de recomendação em ruby
 
Do MONOLÍTICO à arquitetura distribuída
Do MONOLÍTICO à arquitetura distribuídaDo MONOLÍTICO à arquitetura distribuída
Do MONOLÍTICO à arquitetura distribuída
 
Minitest
MinitestMinitest
Minitest
 
Deploy Heroku
Deploy HerokuDeploy Heroku
Deploy Heroku
 

Recently uploaded

WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
Luigi Fugaro
 
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdfBaha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid
 
Stork Product Overview: An AI-Powered Autonomous Delivery Fleet
Stork Product Overview: An AI-Powered Autonomous Delivery FleetStork Product Overview: An AI-Powered Autonomous Delivery Fleet
Stork Product Overview: An AI-Powered Autonomous Delivery Fleet
Vince Scalabrino
 
Transforming Product Development using OnePlan To Boost Efficiency and Innova...
Transforming Product Development using OnePlan To Boost Efficiency and Innova...Transforming Product Development using OnePlan To Boost Efficiency and Innova...
Transforming Product Development using OnePlan To Boost Efficiency and Innova...
OnePlan Solutions
 
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom KittEnhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Peter Caitens
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
Patrick Weigel
 
Building API data products on top of your real-time data infrastructure
Building API data products on top of your real-time data infrastructureBuilding API data products on top of your real-time data infrastructure
Building API data products on top of your real-time data infrastructure
confluent
 
What is Continuous Testing in DevOps - A Definitive Guide.pdf
What is Continuous Testing in DevOps - A Definitive Guide.pdfWhat is Continuous Testing in DevOps - A Definitive Guide.pdf
What is Continuous Testing in DevOps - A Definitive Guide.pdf
kalichargn70th171
 
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
widenerjobeyrl638
 
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Paul Brebner
 
42 Ways to Generate Real Estate Leads - Sellxpert
42 Ways to Generate Real Estate Leads - Sellxpert42 Ways to Generate Real Estate Leads - Sellxpert
42 Ways to Generate Real Estate Leads - Sellxpert
vaishalijagtap12
 
Boost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management AppsBoost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management Apps
Jhone kinadey
 
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSISDECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
Tier1 app
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
dakas1
 
Penify - Let AI do the Documentation, you write the Code.
Penify - Let AI do the Documentation, you write the Code.Penify - Let AI do the Documentation, you write the Code.
Penify - Let AI do the Documentation, you write the Code.
KrishnaveniMohan1
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
Alberto Brandolini
 
How GenAI Can Improve Supplier Performance Management.pdf
How GenAI Can Improve Supplier Performance Management.pdfHow GenAI Can Improve Supplier Performance Management.pdf
How GenAI Can Improve Supplier Performance Management.pdf
Zycus
 
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
kgyxske
 
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptxOperational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
sandeepmenon62
 

Recently uploaded (20)

WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
 
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdfBaha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
 
bgiolcb
bgiolcbbgiolcb
bgiolcb
 
Stork Product Overview: An AI-Powered Autonomous Delivery Fleet
Stork Product Overview: An AI-Powered Autonomous Delivery FleetStork Product Overview: An AI-Powered Autonomous Delivery Fleet
Stork Product Overview: An AI-Powered Autonomous Delivery Fleet
 
Transforming Product Development using OnePlan To Boost Efficiency and Innova...
Transforming Product Development using OnePlan To Boost Efficiency and Innova...Transforming Product Development using OnePlan To Boost Efficiency and Innova...
Transforming Product Development using OnePlan To Boost Efficiency and Innova...
 
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom KittEnhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
 
Building API data products on top of your real-time data infrastructure
Building API data products on top of your real-time data infrastructureBuilding API data products on top of your real-time data infrastructure
Building API data products on top of your real-time data infrastructure
 
What is Continuous Testing in DevOps - A Definitive Guide.pdf
What is Continuous Testing in DevOps - A Definitive Guide.pdfWhat is Continuous Testing in DevOps - A Definitive Guide.pdf
What is Continuous Testing in DevOps - A Definitive Guide.pdf
 
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
 
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
 
42 Ways to Generate Real Estate Leads - Sellxpert
42 Ways to Generate Real Estate Leads - Sellxpert42 Ways to Generate Real Estate Leads - Sellxpert
42 Ways to Generate Real Estate Leads - Sellxpert
 
Boost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management AppsBoost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management Apps
 
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSISDECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
 
Penify - Let AI do the Documentation, you write the Code.
Penify - Let AI do the Documentation, you write the Code.Penify - Let AI do the Documentation, you write the Code.
Penify - Let AI do the Documentation, you write the Code.
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
 
How GenAI Can Improve Supplier Performance Management.pdf
How GenAI Can Improve Supplier Performance Management.pdfHow GenAI Can Improve Supplier Performance Management.pdf
How GenAI Can Improve Supplier Performance Management.pdf
 
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
 
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptxOperational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
 

Debugging with pry

  • 2. Who Am I? GitHub: mcapanema BankFacil (We are Hiring!) Murilo Capanema - 2015
  • 3. What is pry ? Pry is a powerful alternative to the standard IRB shell for Ruby. Murilo Capanema - 2015
  • 4. Why pry ? Features: 4 syntax highlighting; 4 flexible plugin architecture; 4 runtime invocation and source and documentation browsing; Murilo Capanema - 2015
  • 5. Why not to use pry ? Murilo Capanema - 2015
  • 7. What really is pry ? One line of ruby: def repl loop{ puts eval $stdin.readline} end Murilo Capanema - 2015
  • 8. A little bit of REPL Read Eval Print Loop Murilo Capanema - 2015
  • 9. A little bit of REPL REPL with Tests 4 REPL first !; 4 Record what the code should do "; 4 Write a code that works first time #; Murilo Capanema - 2015
  • 10. Why REPL ? REPL or Debugger Driven Development helps you to reach a code that works pretty quickly Murilo Capanema - 2015
  • 11. Backing to pry require 'pry' binding.pry Murilo Capanema - 2015
  • 12. Pry and his friends 4 pry-stack-explorer; 4 pry-debugger; 4 pry-rescue; 4 pry-doc; 4 pry-git; 4 help Murilo Capanema - 2015
  • 13. Pry magics ls [1] pry(main)> ls self.methods: inspect to_s locals: _ __ _dir_ _ex_ _file_ _in_ _out_ _pry_ [2] pry(main)> Murilo Capanema - 2015
  • 14. Pry magics ls [1] pry(main)> ls Kernel constants: RUBYGEMS_ACTIVATION_MONITOR Kernel.methods: Array Rational abort block_given? exit global_variables open putc require sprintf trace_var Complex String ap caller exit! iterator? p puts require_relative srand trap Float __callee__ at_exit caller_locations fail lambda pp raise select syscall untrace_var Hash __dir__ autoload catch fork load print rand set_trace_func system warn Integer __method__ autoload? eval format local_variables printf readline sleep test Pathname ` binding exec gets loop proc readlines spawn throw Kernel#methods: !~ clone frozen? kind_of? public_methods tainted? <=> debugger hash method public_send tap === define_singleton_method inspect methods remove_instance_variable to_enum =~ display instance_of? nil? respond_to? to_s ai dup instance_variable_defined? object_id send trust awesome_inspect enum_for instance_variable_get pretty_inspect singleton_class untaint awesome_print eql? instance_variable_set private_methods singleton_method untrust byebug extend instance_variables protected_methods singleton_methods untrusted? class freeze is_a? public_method taint [2] pry(main)> Murilo Capanema - 2015
  • 15. Pry magics $ - show-source [1] pry(main)> $ Kernel#puts From: io.c (C Method): Owner: Kernel Visibility: private Number of lines: 8 static VALUE rb_f_puts(argc, argv) int argc; VALUE *argv; { rb_io_puts(argc, argv, rb_stdout); return Qnil; } [2] pry(main)> Murilo Capanema - 2015
  • 16. Pry magics $ - show-source [1] pry(main)> $ Hash From: /home/vagrant/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/pp.rb @ line 369: Class name: Hash Number of lines: 9 class Hash # :nodoc: def pretty_print(q) # :nodoc: q.pp_hash self end def pretty_print_cycle(q) # :nodoc: q.text(empty? ? '{}' : '{...}') end end [2] pry(main)> Murilo Capanema - 2015
  • 17. Pry magics ? - show-doc [1] pry(main)> ? Object From: /home/vagrant/.rvm/gems/ruby-2.1.3/gems/awesome_print-1.2.0/lib/awesome_print/core_ext/object.rb @ line 1: Class name: Object Number of monkeypatches: 6. Use the `-a` option to display all available monkeypatches Number of lines: 5 ... ... ... [2] pry(main)> Murilo Capanema - 2015
  • 18. Pry magics break [1] pry(main)> break method_name Breakpoint 1: /path/to/file.rb @ line 1 (Enabled): ... ... ... [2] pry(main)> Murilo Capanema - 2015
  • 19. Pry magics try-again [1] pry(main)> try-again [2] pry(main)> Murilo Capanema - 2015
  • 20. Pry magics step/next [1] pry(main)> step [2] pry(main)> next Murilo Capanema - 2015
  • 21. Pry magics play [1] pry(main)> play -l 1 [2] pry(main)> Murilo Capanema - 2015
  • 22. Pry magics edit [OPTIONS] 4 -e Open editor on last exception raised 4 -m Open editor on a given method 4 -c Open editor on current method [1] pry(main)> edit -m method_name [2] pry(main)> Murilo Capanema - 2015
  • 23. Pry magics up [1] pry(main)> up [2] pry(main)> Murilo Capanema - 2015
  • 24. Pry magics down [1] pry(main)> down [2] pry(main)> Murilo Capanema - 2015
  • 25. Pry magics @ - whereami [1] pry(Kernel):1> cd Kernel#puts [2] pry(Kernel):2> @ Inside Kernel. [3] pry(Kernel):2> Murilo Capanema - 2015
  • 26. Debugging 4 Reproduce locally; 4 Find the problem; 4 Fix it; Murilo Capanema - 2015
  • 27. More pry magics wtf - _ex_.backtrace [1] pry(Kernel):1> wtf? ... ... ... [2] pry(Kernel):2> Murilo Capanema - 2015
  • 29. Fin GitHub: mcapanema Seriously We are Hiring! Murilo Capanema - 2015