==(p1)
public
Returns true only if obj is a Range, has
equivalent beginning and end items (by
comparing them with ==), and has the same #exclude_end? setting as
<i>rng</t>.
(0..2) == (0..2)
(0..2) == Range.new(0,2)
(0..2) == (0...2)
Show source
/*
* call-seq:
* rng == obj => true or false
*
* Returns <code>true</code> only if <i>obj</i> is a Range, has equivalent
* beginning and end items (by comparing them with <code>==</code>), and has
* the same
*
* (0..2) == (0..2)
* (0..2) == Range.new(0,2)
* (0..2) == (0...2)
*
*/
static VALUE
range_eq(range, obj)
VALUE range, obj;
{
if (range == obj) return Qtrue;
if (!rb_obj_is_instance_of(obj, rb_obj_class(range)))
return Qfalse;
if (!rb_equal(rb_ivar_get(range, id_beg), rb_ivar_get(obj, id_beg)))
return Qfalse;
if (!rb_equal(rb_ivar_get(range, id_end), rb_ivar_get(obj, id_end)))
return Qfalse;
if (EXCL(range) != EXCL(obj)) return Qfalse;
return Qtrue;
}