method
minmax_by
v1_9_3_392 -
Show latest stable
- Class:
Enumerable
minmax_by()public
Returns two elements array array containing the objects in enum that gives 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"]