Created
July 31, 2012 20:57
-
-
Save banister/3220467 to your computer and use it in GitHub Desktop.
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
my_pilot = PryAutopilot.new do | |
on ->(frame) { frame.eval("@i == x") } do | |
puts "fizz (@i == x) x is #{frame.var("x")}" | |
end | |
on ->(frame) { frame.eval("@i == y") } do | |
puts "buzz (@i == y) y is #{frame.var("y")}" | |
end | |
on ->(frame) { frame.eval("@i == (y + x)") } do | |
puts "fizzbuzz (@i == (x + y)), (x + y) is #{frame.eval("x+y")}" | |
run "exit-all" | |
end | |
on ->(frame) { true } do | |
run "step" | |
end | |
end | |
Pry.config.input = my_pilot | |
def fizzbuzz(x, y) | |
binding.pry | |
@i = 0 | |
1.upto(100) { |i| @i = i } | |
end | |
fizzbuzz(3, 5) |
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
fizz (@i == x) x is 3 | |
buzz (@i == y) y is 5 | |
fizzbuzz (@i == (x + y)), (x + y) is 8 |
jasonLaster
commented
Jul 31, 2012
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment