How to find the max value, then the key of a hash in ruby


my_hash = {:a => 1, :b => 12, :c => 23, :d => 3 }
max_value = my_hash.values.max #23
max_value_key = my_hash.key(max_value) #:c