Method: Struct#==
- Defined in:
- struct.c
#==(other_struct) ⇒ Boolean
Equality—Returns true if other_struct is equal to this one: they must be of the same class as generated by Struct::new, and the values of all instance variables must be equal (according to Object#==).
Customer = Struct.new(:name, :address, :zip)
joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
joejr = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
jane = Customer.new("Jane Doe", "456 Elm, Anytown NC", 12345)
joe == joejr #=> true
joe == jane #=> false
783 784 785 |
# File 'struct.c', line 783 static VALUE rb_struct_equal(s, s2) VALUE s, s2; |