Enumerable#tally in Ruby!
One of the joys of working with Ruby is uncovering little-known gems that simplify our code and make data exploration a breeze.
Introduced in 2.7, It's great for quickly exploring your data without writing a bunch of loops and counters. I've started using this in prod to figure things out quite a lot!
In just a single, succinct line, tally allows you to answer these questions. Ruby’s expressive nature combined with the power of this method ensures that your code remains clean, readable, and efficient.