new(...)
public
Constructs a range using the given start and end. If the third parameter is omitted or
is false, the range will include the end object; otherwise, it will be excluded.
Show source
/*
* call-seq:
* Range.new(start, end, exclusive=false) => range
*
* Constructs a range using the given <i>start</i> and <i>end</i>. If the third
* parameter is omitted or is <code>false</code>, the <i>range</i> will include
* the end object; otherwise, it will be excluded.
*/
static VALUE
range_initialize(argc, argv, range)
int argc;
VALUE *argv;
VALUE range;
{
VALUE beg, end, flags;
rb_scan_args(argc, argv, "21", &beg, &end, &flags);
/* Ranges are immutable, so that they should be initialized only once. */
if (rb_ivar_defined(range, id_beg)) {
rb_name_error(rb_intern("initialize"), "`initialize' called twice");
}
range_init(range, beg, end, RTEST(flags));
return Qnil;
}