Method: Struct#eql?
- Defined in:
- struct.c
permalink #eql? ⇒ Object
code-seq:
struct.eql?(other) -> true or false
Two structures are equal if they are the same object, or if all their fields are equal (using eql?
).
|
# File 'struct.c'
/*
* code-seq:
* struct.eql?(other) -> true or false
*
* Two structures are equal if they are the same object, or if all their
* fields are equal (using <code>eql?</code>).
*/
static VALUE
rb_struct_eql(VALUE s, VALUE s2)
{
if (s == s2) return Qtrue;
if (TYPE(s2) != T_STRUCT) return Qfalse;
if (rb_obj_class(s) != rb_obj_class(s2)) return Qfalse;
if (RSTRUCT_LEN(s) != RSTRUCT_LEN(s2)) {
rb_bug("inconsistent struct"); /* should never happen */
}
return rb_exec_recursive_paired(recursive_eql, s, s2, s2);
}
|