October 2006
Intermediate to advanced
888 pages
16h 55m
English
The ruby-breakpoint library is the creation of Florian Gross. This wonderful little tool enables you to set breakpoints in your code with the breakpoint method. When a breakpoint is encountered, you are thrown into an irb session. (The irb tool, interactive Ruby, is covered in more detail in Chapter 21.)
This is not part of the standard library. Install it by doing a gem install ruby-breakpoint or by any other method.
Let’s take Listing 16.4 and make a couple of changes. We’ll add require 'breakpoint' at the beginning and then add a call to the breakpoint method sometime after both the gets calls:
require 'breakpoint' # ... w2 = gets.chomp breakpoint # ...
Now let’s run this. The following session shows how we enter ...
Read now
Unlock full access