Method: Range#initialize

Defined in:
range.c

#newObject

Returns a new range based on the given objects begin and end. Optional argument exclude_end determines whether object end is included as the last object in the range:

Range.new(2, 5).to_a            # => [2, 3, 4, 5]
Range.new(2, 5, true).to_a      # => [2, 3, 4]
Range.new('a', 'd').to_a        # => ["a", "b", "c", "d"]
Range.new('a', 'd', true).to_a  # => ["a", "b", "c"]
[View source]

101
102
103
104
105
106
107
108
109
110
# File 'range.c', line 101

static VALUE
range_initialize(int argc, VALUE *argv, VALUE range)
{
    VALUE beg, end, flags;

    rb_scan_args(argc, argv, "21", &beg, &end, &flags);
    range_modify(range);
    range_init(range, beg, end, RBOOL(RTEST(flags)));
    return Qnil;
}