Image of Lucian Ghinda writing for notes.ghinda.com
November 7th, 2024

Object#tap and debugger in Ruby

I sometimes use Object\#tapwith debugger to debug chained methods

Code sample showing tap and debugger
Code sample showing tap and debugger

That will show the following output:

Output of running the previous example
Output of running the previous example

Another useful trick for me is to setup a debugger and also set a new breakpoint at the end:

Setting a new breakpoint
Setting a new breakpoint

That will show the following output

Output of running the debugger(pre: "break 8")
Output of running the debugger(pre: "break 8")