Awesome Print is a Ruby gem that prints prettified objects to the console. To avoid having to prepend ap
to all your console commands, set it as the default formatter in IRB and Rails by adding the following to your ~/.irbrc
:
require 'awesome_print' IRB::Irb.class_eval do def output_value ap @context.last_value end end
Obviously, Awesome Print first needs to be installed: gem install awesome_print
UPDATE: Awesome Print now includes a method to make the integration process easier.
require 'awesome_print' AwesomePrint.irb!
Leave a Reply