Project

toffee

0.0
No commit activity in last 3 years
No release in over 3 years
Debugging convenience for your ruby application
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.2.9
 Project Readme

Toffee¶ ↑

Candy for your “puts”-debugging!

Usage¶ ↑

Put the method call: “d” (almost) anywhere in your code to print out debug information:

['a', 'b', 'c'].d.first.d.upcase.d

will print out:

["a", "b", "c"]
"a"
"A"

“d” always returns self, so it will not interfere or do any harm.

Configure the output (optional)¶ ↑

Write to standard output (default):

Toffee.configure(STDOUT)

or

Toffee.configure(:stdout)

Write to any object that implements “:puts”:

Toffee.configure(IO.new(2, 'w'))

Write to any object that implements “:debug”:

Toffee.configure(Rails.logger)

Write to any object that implements the second parameter:

Toffee.configure(Rails.logger, :info)

Write to file using the shell command:

$ echo "my output here" > /tmp/foo.log

Toffee.configure('/tmp/foo.log')

More options to use with Toffee.configure¶ ↑

:timestamp

Turn on timestamps with true, turn if off with nil or false; to use a custom timestamp format, pass a string with a Time.strftime kind of format

Copyright © 2010 Christoph Petschnig. See LICENSE for details.

Inspiration and parts of the code taken from Jan Lelis (github.com/janlelis/zucker)