/* * 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(obj) VALUE obj; { VALUE result = Qundef; rb_iterate(rb_each, obj, rb_block_given_p() ? min_ii : min_i, (VALUE)&result); if (result == Qundef) return Qnil; return result; }