I want to use min(5,10), or Math.max(4,7). Are there functions to this effect in Ruby?
min(5,10)
Math.max(4,7)
If you need to find the max/min of a hash, you can use #max_by or #min_by
#max_by
#min_by
people = {'joe' => 21, 'bill' => 35, 'sally' => 24} people.min_by { |name, age| age } #=> ["joe", 21] people.max_by { |name, age| age } #=> ["bill", 35]