Created
March 10, 2017 02:25
-
-
Save pocari/9d3f1e4bcd22c1710ad5cc8df6fdd4d1 to your computer and use it in GitHub Desktop.
pry-byebug でループのデバッグ (loop pry debug break)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bash-3.2$ cat -n test.rb | |
1 # stop at before loop | |
2 # and break (or conditional break) | |
3 # e.g) | |
4 # > break 8 if i >= 18 | |
5 # and run continue. then stop at next binding.pry | |
6 binding.pry | |
7 1.upto(20).each do |i| | |
8 p i | |
9 end | |
10 | |
11 binding.pry | |
12 p :sum | |
bash-3.2$ ruby -rpry-byebug test.rb | |
From: /Users/pocari/dev/tmp/20170310/test.rb @ line 7 : | |
2: # and break (or conditional break) | |
3: # e.g) | |
4: # > break 8 if i >= 18 | |
5: # and run continue. then stop at next binding.pry | |
6: binding.pry | |
=> 7: 1.upto(20).each do |i| | |
8: p i | |
9: end | |
10: | |
11: binding.pry | |
12: p :sum | |
[1] pry(main)> break 8 if i >= 18 | |
Breakpoint 1: /Users/pocari/dev/tmp/20170310/test.rb @ 8 (Enabled) Condition: i >= 18 | |
5: # and run continue. then stop at next binding.pry | |
6: binding.pry | |
7: 1.upto(20).each do |i| | |
=> 8: p i | |
9: end | |
10: | |
11: binding.pry | |
[2] pry(main)> continue | |
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
Breakpoint 1. First hit | |
Condition: i >= 18 | |
From: /Users/pocari/dev/tmp/20170310/test.rb @ line 8 : | |
3: # e.g) | |
4: # > break 8 if i >= 18 | |
5: # and run continue. then stop at next binding.pry | |
6: binding.pry | |
7: 1.upto(20).each do |i| | |
=> 8: p i | |
9: end | |
10: | |
11: binding.pry | |
12: p :sum | |
[2] pry(main)> i | |
=> 18 | |
[3] pry(main)> continue | |
18 | |
Breakpoint 1. Hit 2 times. | |
Condition: i >= 18 | |
From: /Users/pocari/dev/tmp/20170310/test.rb @ line 8 : | |
3: # e.g) | |
4: # > break 8 if i >= 18 | |
5: # and run continue. then stop at next binding.pry | |
6: binding.pry | |
7: 1.upto(20).each do |i| | |
=> 8: p i | |
9: end | |
10: | |
11: binding.pry | |
12: p :sum | |
[3] pry(main)> i | |
=> 19 | |
[4] pry(main)> continue | |
19 | |
Breakpoint 1. Hit 3 times. | |
Condition: i >= 18 | |
From: /Users/pocari/dev/tmp/20170310/test.rb @ line 8 : | |
3: # e.g) | |
4: # > break 8 if i >= 18 | |
5: # and run continue. then stop at next binding.pry | |
6: binding.pry | |
7: 1.upto(20).each do |i| | |
=> 8: p i | |
9: end | |
10: | |
11: binding.pry | |
12: p :sum | |
[4] pry(main)> i | |
=> 20 | |
[5] pry(main)> continue | |
20 | |
From: /Users/pocari/dev/tmp/20170310/test.rb @ line 12 : | |
7: 1.upto(20).each do |i| | |
8: p i | |
9: end | |
10: | |
11: binding.pry | |
=> 12: p :sum | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment