Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The Good Way to Debug w/ Gem

The Good Way to Debug w/ Gem

Sam Yamashita

April 25, 2014
Tweet

More Decks by Sam Yamashita

Other Decks in Technology

Transcript

  1. guard pry pry-nav guard 'rspec' do # watch /lib/ files

    watch(%r{^lib/(.+)\.rb$}) do |m| "spec/#{m[1]}_spec.rb" end ! # watch /spec/ files watch(%r{^spec/(.+)\.rb$}) do |m| "spec/#{m[1]}.rb" end end Guardfile $ bundle exec guard 09:53:55 - INFO - Guard is using Tmux to send notifications. 09:53:55 - INFO - Guard is using TerminalTitle to send notifications. 09:53:55 - INFO - Guard::RSpec is running 09:53:55 - INFO - Guard is now watching at '/path/to/Sinderella'
  2. guard pry pry-nav require 'pry' ! class A def hello()

    puts "hello world!" end end ! a = A.new ! # set x to 10 x = 10 ! # start a REPL session binding.pry ! # program resumes here (after pry session) puts "program resumes here. Value of x is: #{x}." test.rb
  3. guard pry pry-nav pry(main)> a.hello hello world! => nil pry(main)>

    puts x 10 => nil pry(main)> def a.goodbye pry(main)* puts "goodbye cruel world!" pry(main)* end => nil pry(main)> a.goodbye goodbye cruel world! => nil pry(main)> x = "changed" pry(main)> exit ! # OUTPUT: program resumes here Value of x is: changed.