I have a Ruby array
> list = Request.find_all_by_artist(\"Metallica\").map(&:song) => [\"Nothing else Matters\", \"Enter sandman\", \"Enter Sandman
As of Ruby 2.7, you can use Enumerable#tally.
Enumerable#tally
list.tally # => {"Nothing else Matters"=>1, "Enter sandman"=>1, "Enter Sandman"=>1, "Master of Puppets"=>3}