<commit_before>A modular, testable debugger for Ruby 1.9

Some cryptic examples.

Running if rbdbgr is installed:

bc. rbdbgr ruby-program [program]

If your program needs options of its own:

bc. rbdbgr -- ruby-program [program args...]

Running from inside irb:

bc. require 'rbdbgr' 
 Debugger.debug { your code }

You can do the same thing inside your Ruby program, but probably you don't want to give a block. Instead, you may want to have debugging start on the next statement in the code:

bc. require 'rbdbgr' 
 Debugger.debug # Don't stop here...
 work # but stop here.

or if you haven't mucked around with $0 and ARGV, you might try:

bc. Debugger.debug(:set_restart=>true)

which informs the debugger on how to restart the program (via the restart command) using the values of ARGV and $0 at the time Debugger.debug was called.

The above is really shorthand for something like:

bc. mydbg = Debugger.new(:set_restart=>true) 
 mydbg.debugger

Debugger.debug returns a debugger object (mydbg above) which can then be used over again. The debugger object holds debugger settings.

If for some reason you want a synchronous stop in your program call to the debugger at the point of the call, set opts[:immediate] to true. Example:

bc. # ... work, work, work 
 mydbg.debugger(:immediate=>true) # enter debugger here 
 # ... work, work, work<commit_msg>Add a lead space in 1st line in example code.<commit_after>A modular, testable debugger for Ruby 1.9

Some cryptic examples.

Running if rbdbgr is installed:

bc.  rbdbgr ruby-program [program]

If your program needs options of its own:

bc. rbdbgr -- ruby-program [program args...]

Running from inside irb:

bc.  require 'rbdbgr' 
 Debugger.debug { your code }

You can do the same thing inside your Ruby program, but probably you don't want to give a block. Instead, you may want to have debugging start on the next statement in the code:

bc.  require 'rbdbgr' 
 Debugger.debug # Don't stop here...
 work # but stop here.

or if you haven't mucked around with $0 and ARGV, you might try:

bc.  Debugger.debug(:set_restart=>true)

which informs the debugger on how to restart the program (via the restart command) using the values of ARGV and $0 at the time Debugger.debug was called.

The above is really shorthand for something like:

bc.  mydbg = Debugger.new(:set_restart=>true) 
 mydbg.debugger

Debugger.debug returns a debugger object (mydbg above) which can then be used over again. The debugger object holds debugger settings.

If for some reason you want a synchronous stop in your program call to the debugger at the point of the call, set opts[:immediate] to true. Example:

bc.  # ... work, work, work 
 mydbg.debugger(:immediate=>true) # enter debugger here 
 # ... work, work, work
{'fraction_non_alphanumeric': 0.07355072463768116, 'fraction_numerical': 0.003260869565217391, 'mean_word_length': 3.8523725834797893, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4758987', 'n_tokens_mistral': 834, 'n_tokens_neox': 796, 'n_words': 406}