Using the Awesome Print Gem
You must use the
Noosfero Console to follow this steps.
In Noosfero, and in every Rails project, you might have lots of classes and different types of objects that actually are not as simple as a string. Sometimes you need to debug an object that is related to other objects and when you try to see what's going on you need to build a script to show object attribute in a human way. That's where Awesome Print comes in!
Awesome Print is a gem written mostly by
Michael Dvorkin that prints almost all kinds of objects in human, colorized, indented and AWESOME way! ^^
Here is a simple use of it showing how you will see a Profile with the default print and with Awesome Print:
Pretty neat, isn't it?
So now that you started loving Awesome Print just like me, here are the steps to install and use it as your Rails stdout method:
1. Install awesome print
(sudo) gem install awesome_print # "sudo" is for optional system wide installation
2. Include this lines to your
~/.irbrc
require 'rubygems'
require 'ap'
IRB::Irb.class_eval do
def output_value
ap @context.last_value
end
end
Done! Easy and awesome.
Now you can just enjoy this cool gem at your console as the default printer.
You can find Awesome Print sources and docs in this following page:
http://github.com/michaeldv/awesome_print
--
RodrigoSouto - 13 Jul 2010