There is no Math.max function. Instead, use an array:
>> [2,3,4].max
=> 4
I would argue there should be, because it is not intuitively obvious that this type of integer comparison would live off of an array. One argument could be that the array approach allows for non-integer types to be compared, and that the increase in flexibility has an increase in obscurity as its side-effect…
>> ["chicken","fox"].max
=> "fox"
Math.max or why is there no integer maximum function in ruby 2
Posted by chad
on December 07, 2007