Method: Subnets::Net4#==

Defined in:
ext/subnets/ext.c

#==(other) ⇒ Boolean Also known as: eql?

Returns:

  • (Boolean)


639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
# File 'ext/subnets/ext.c', line 639

VALUE
method_net4_eql_p(VALUE self, VALUE other) {
  net4_t *a, *b;

  if (CLASS_OF(other) != CLASS_OF(self)) {
    return Qfalse;
  }

  Data_Get_Struct(self, net4_t, a);
  Data_Get_Struct(other, net4_t, b);

  if (a->prefixlen != b->prefixlen) {
    return Qfalse;
  }
  if (a->address != b->address) {
    return Qfalse;
  }
  return Qtrue;
}