Check out example codes for "How to find the key of the largest value hash?". It will help you in understanding the concepts better.
Code Example 1
# short version hash.key(hash.values.max) # longer more flexable version: puts hash.max_by(&:last).first #without the .first you get the key and the value pair as array
Learn ReactJs, React Native from akashmittal.com