method

assert

assert(context = nil, &condition)
public

This asserts that the block evaluates to true. If it doesn’t evaluate to true a breakpoint will automatically be created at that execution point.

You can disable assert checking in production code by setting Breakpoint.optimize_asserts to true. (It will still be enabled when Ruby is run via the -d argument.)

Example:

  person_name = "Foobar"
  assert { not person_name.nil? }

Note: If you want to use this method from an unit test, you will have to call it by its full name, Breakpoint.assert.