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"]
Show source
Register or log in to add new notes.