Scott Watermasysk Husband, Father, Bootstrapper, Developer, Keyboarder, Pained Sixers Fan.

Ruby 2.7  Enumerable#tally

Published:

I am looking forward to this. I often use code that looks like this:

h = Hash.new(0)

items.each {|item| h[item] += 1}

What makes this work is whatever you pass to Hash in the initializer is used as the default value.

👉 https://medium.com/@baweaver/ruby-2-7-enumerable-tally-a706a5fb11ea