enum.max_by { |obj| block } â objenum.max_by â an_enumerator
Instance Public methods
Returns the object in enum that gives the maximum value from the
given block.
If no block is given, an enumerator is returned instead.
a = %w(albatross dog horse)
a.max_by { |x| x.length } #=> "albatross"