Ved at bruge .tally kan man tælle antal forekomster i et array
.tally
["a", "b", "c", "b"].tally #=> {"a"=>1, "b"=>2, "c"=>1}