Method: Enumerable#tally

Defined in:
enum.c

#tallyHash

Tallies the collection, i.e., counts the occurrences of each element. Returns a hash with the elements of the collection as keys and the corresponding counts as values.

["a", "b", "c", "b"].tally  #=> {"a"=>1, "b"=>2, "c"=>1}

Returns:



1046
1047
1048
1049
1050
# File 'enum.c', line 1046

static VALUE
enum_tally(VALUE obj)
{
    return enum_hashify(obj, 0, 0, tally_i);
}