min(*args)
public
Returns the minimum value in the range. Returns nil if the begin value of the range is larger than the end value.
Can be given an optional block to override the default comparison method a
<=> b.
(10..20).min
static VALUE
range_min(int argc, VALUE *argv, VALUE range)
{
if (rb_block_given_p()) {
return rb_call_super(argc, argv);
}
else if (argc != 0) {
return range_first(argc, argv, range);
}
else {
VALUE b = RANGE_BEG(range);
VALUE e = RANGE_END(range);
int c = rb_cmpint(rb_funcall(b, id_cmp, 1, e), b, e);
if (c > 0 || (c == 0 && EXCL(range)))
return Qnil;
return b;
}
}