Posted about 7 years ago. Visible to the public. Repeats. Linked content.

Make your Rails console (and irb) output better readable

Pour color on your Rails console with awesome_print. Turn confusing long strings into formatted output. Have objects and classes laid out clearly whenever you need it.

Put gem 'awesome_print', :group => :development into your Gemfile. Now on the Rails console you have the command ap that will give you a colored, formatted output of whatever you pass it. See the example output of the User class below.

For customization visit the repository on Github.

awesome_print.png

Remark

Note that there are other ways to print data in a structured way. Ruby's pretty-print library pp handles formatted printing (you might need to require 'pp'). Pry will give you a readable output, too. If it's already used in your project, you probably won't need to use awesome_print either.

makandra has been working exclusively with Ruby on Rails since 2007. Our laser focus on a single technology has made us a leader in this space.

Owner of this card:

Avatar
Dominik Schöler
Last edit:
about 1 year ago
by Florian Leinsinger
Attachments:
awesome_print.png
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Dominik Schöler to makandra dev
This website uses cookies to improve usability and analyze traffic.
Accept or learn more