eql?(p1)
public
Returns true only if obj is a Range, has
equivalent beginning and end items (by
comparing them with #eql?), and has the
same #exclude_end? setting as
rng.
(0..2) == (0..2)
(0..2) == Range.new(0,2)
(0..2) == (0...2)
Show source
/*
* call-seq:
* rng.eql?(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 #eql?), and has the same
* #exclude_end? setting as <i>rng</i>.
*
* (0..2) == (0..2)
* (0..2) == Range.new(0,2)
* (0..2) == (0...2)
*
*/
static VALUE
range_eql(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_eql(rb_ivar_get(range, id_beg), rb_ivar_get(obj, id_beg)))
return Qfalse;
if (!rb_eql(rb_ivar_get(range, id_end), rb_ivar_get(obj, id_end)))
return Qfalse;
if (EXCL(range) != EXCL(obj)) return Qfalse;
return Qtrue;
}