TypedPrint - Tables to Hashes

Hi folks :waving_hand:

So here’s the story. I was bored last night after work and wanted to build something simple, maybe open source. Also wanted to try out DeepSeek a bit. So I made this little gem called typed_print.

I haven’t shared this anywhere yet. This forum is the first place I’m posting because I like the community here and it feels genuine.

It’s nothing huge. Just turns hashes into clean tables in the terminal.

Example:

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  

Features:

  • Zero dependencies
  • Column alignment (left/right/center)
  • Filter columns with only:
  • Custom headers with headers:

Install:

gem install typed_print

Links:

I’d really appreciate your feedback. Let me know what you think.

Thanks for reading :folded_hands:

4 Likes

I often like to copy things into my logs, which I keep in markdown. Could you add an option so that it printed out the table in markdown? It’d be super helpful if is also keeps the spacing, so that it looks good both in plain text and markdown.

Thanks for the suggestion, Todd! Just released v0.2.0 with markdown support.

Here’s how it looks:

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, format: :markdown)

Name Price In Stock Notes
Product A 29.99 true
Product B 49.99 false Limited

The spacing is preserved so it looks good in both plain text and markdown.

gem update typed_print to try it out.

Thanks again for the feedback! Let me know if you have any trouble. :folded_hands:

1 Like

That’s great customer service! Thanks.

1 Like

Ahaha anytime man! Happy typed printing :zany_face:

Added colorsupport :artist_palette:

Color support is optional and requires the pastel gem.

Add it to your Gemfile:

gem 'pastel'

Automatic coloring by type:

TypedPrint.print(data, color: true) 
# Headers → cyan, Integer/Float/true → green, false → red, nil → gray

Manual per-column colors:

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