Hash values identified by non Strings/ Symbols

It is absolutely common, to find Hash values by String/ Symbol keys:

numbers = { 1: 'one', 2: 'two', 3: 'three' }
numbers[:2] # => "two"

But the key can be any type:

mixed = { 1 => 1, 3.5 => 'threepointfive', 1..5 => 'Range between 1 and 5' }
mixed[3.5] # => 'threepointfive'
mixed[1..5] # => 'Range between 1 and 5'

Of course the key has to be distinct. Otherwise Ruby returns with a warning and the first key/ value pair is ignored:

numbers = { 2 => 2, 2 => 'two' } # warning: duplicated key at line 1 ignored: 2
# => {2=>"two"}

A more meaningful use case could look like (based on ActiveRecord::Base for clarity reasons):

people = Person.all.group_by(&:birthday) 
# => { Sat, 21 Sep 1996 => [#<Person 1>, #<Person 2>], Fri, 19 Apr 1996 => [#<Person 3>] }

The ActiveRecord::Base model Person finds all people. The result set is iterated by the enumerator Enumerable#group_by{rel: ‘nofollow’} and grouped by the particular persons birthday, whereas the key is the birthday itself with the type Date.
Then the access looks like:

people[18.years.ago] # => [#<Person 1>, #<Person 2>]

Awesome.