enum.minmax_by { |obj| block } â [min, max]
enum.minmax_by â an_enumerator
enum.minmax_by â an_enumerator
Instance Public methods
Returns a two element array containing the objects in enum that correspond to the minimum and maximum values respectively from the given block.
If no block is given, an enumerator is returned instead.
a = %w(albatross dog horse) a.minmax_by { |x| x.length } #=> ["dog", "albatross"]
Please login to continue.