I built a Ruby gem so I don't have to squint at hash dumps anymore

Published: (May 8, 2026 at 10:58 AM EDT)
3 min read
Source: Dev.to

Source: Dev.to

Cover image for I built a Ruby gem so I don't have to squint at hash dumps anymore

What does it do?

It turns hashes into clean, aligned tables.

require 'typed_print'

data = [
  { name: "Alice", score: 100, active: true },
  { name: "Bob",   score: 42,  active: false }
]

TypedPrint.print(data)

Output

 Name   Score Active 
------+------- -------
Alice    100 true   
Bob       42 false  

That’s it. No magic. No mental parsing.

Why not just use pp or awesome_print?

  • pp is fine, but still hard to scan.
  • awesome_print is great, but sometimes you don’t want colors, JSON support, or extra dependencies.

I wanted something that:

  • Has zero required dependencies
  • Only does tables
  • Works everywhere (Rails, Rake tasks, plain Ruby scripts, even minimal Docker containers)

What can you do with it?

Align columns

TypedPrint.print(data, align: { score: :right })

Show only what you need

TypedPrint.print(data, only: [:name, :score])

Custom headers

TypedPrint.print(data, headers: { name: "User", score: "Points" })

Markdown output (great for docs)

TypedPrint.print(data, format: :markdown)

Outputs a proper markdown table you can copy into GitHub READMEs.

Colors! (v0.3.0)

TypedPrint.print(data, color: true)

Or full control:

TypedPrint.print(
  data,
  colors: { name: :cyan, score: :green, active: :yellow }
)

Pastel is optional. If you don’t have it, colors are ignored without errors.

Example with different data types

mixed = [
  { name: "Product A", price: 29.99, in_stock: true,  notes: nil },
  { name: "Product B", price: 49.99, in_stock: false, notes: "Limited" }
]

TypedPrint.print(mixed)

Output

   Name      Price In_stock Notes        
----------+-------+---------+-------------
Product A   29.99 true                  
Product B   49.99 false    Limited edition

It handles nil, booleans, numbers, and strings automatically.

What about performance?

It’s lightweight. Zero dependencies means no hidden bloat. Tested with 10,000 rows and still fast enough for CLI tools and debugging. For massive datasets, printing them to the terminal is generally not advisable.

Who is this for?

  • Rails developers who debug in the console
  • CLI tool authors who want clean output
  • Anyone who logs hashes and wants them readable

People who are tired of pp.

  • RubyGems:
  • GitHub:
  • Documentation: see the README in the repository.

What’s next?

I’m keeping it simple. No roadmap to become a bloated framework. If you have an idea that fits the “zero‑dependency, just tables” philosophy, open an issue. I shipped markdown support within hours of a user request (that was v0.2.0).

Try it

gem install typed_print

That’s it. You’re done.

If you find it useful, let me know. If you find a bug, also let me know.

Thanks for reading 🙏

0 views
Back to Blog

Related posts

Read more »

str() vs repr() vs print() in Python

Overview When learning Python you encounter three built‑in utilities that often look similar: - str - repr - print At first they may seem to do the same thing—...