Kiss A simpler, smarter web application framework for Ruby

Debugging

SECTIONS
Easily Inspect Any Object Exception Reports Benchmarks

Easily Inspect Any Object

You can inspect any object and have the result sent to the browser by using the debug method:

debug my_hash

This will add a purple box to the top of the resulting page, in your web browser. If you use TextMate on a Mac, this debugging output will also include a convenient link directly back to the line of code that includes the debug statement, so you can remove it easily when you don't need it anymore.

You'll see the purple box when you call the debug method from an action, model, or template.

If you call debug from any other execution point, such as a script that starts your application, or an external library that you've required in your app, then you'll reach a different, global debug method, which prints the object's inspect result to stdout. This will show up in your web browser in CGI applications but will be printed to the console if you're using an application server.

Exception Reports

When an exception is raised, you'll get a nicely formatted exception report, including:

Benchmarks

You can run simple wall-clock benchmarks on your code using the bench method:

bench 'select user profile information'

# lots of user operations here

bench

The bench method both starts and stops timers. If you call bench without an argument, it will stop any timer already running. With a string argument, bench will stop any running timer and start a new one labeled by the passed-in string.

Benchmark results are shown in an orange box at the top of the page returned to your web browser.