Project

spit

0.0
No commit activity in last 3 years
No release in over 3 years
Print vars to your rails console with colors and labels.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0.0
~> 1.6.4
>= 0
~> 2.3.0
 Project Readme

Summary¶ ↑

Spit variables out to your log in a noticeable color. It adds a sensible label automatically.

Usage Examples¶ ↑

You use it by doing something like this:

Spit account

And it puts something like this in the log output (but with color):

account: <#Account @name="Steve">

To show the source of the line (filename, method, and line number) do something like this:

Spit.s account

And it puts something like this in the log output (but with color):

foo_controller.index(38) account: <#Account @name="Steve">

The Point¶ ↑

So you don’t have to keep typing things like this over and over while developing / debugging:

print "foo: #{foo}"

It’s intended to make it easier during development to print out values of variables and have them stand out in the log… pretty simple concept. There might be something out there like it - I didn’t look around very much.

How it works¶ ↑

The only tricky thing about spit is how it creates the label. Under the covers it uses caller() to get the file and line, and then goes and grabs the label from the actual source file. This isn’t super-efficient, but will likely be almost intstantaneous unless you print out a rather large number of variables at once.

Future plans¶ ↑

Support for multiple variables, like: Spit(account, user)

Support for choosing a color, like: Spit.red account

Copyright © 2011 trogdoro. See LICENSE.txt for further details.