/*
* call-seq:
* enum.min => obj
* enum.min {| a,b | block } => obj
*
* Returns the object in <i>enum</i> with the minimum value. The
* first form assumes all objects implement <code>Comparable</code>;
* the second uses the block to return <em>a <=> b</em>.
*
* a = %w(albatross dog horse)
* a.min #=> "albatross"
* a.min {|a,b| a.length <=> b.length } #=> "dog"
*/
static VALUE
enum_min(VALUE obj)
{
VALUE result[2];
result[0] = Qundef;
if (rb_block_given_p()) {
result[1] = rb_ary_new3(2, Qnil, Qnil);
rb_block_call(obj, id_each, 0, 0, min_ii, (VALUE)result);
}
else {
rb_block_call(obj, id_each, 0, 0, min_i, (VALUE)result);
}
if (result[0] == Qundef) return Qnil;
return result[0];
}