stitchfix/immutable-struct

Value equality

Closed this issue · 3 comments

Struct also provides a built in value based equality:

Person = Struct.new(:name, :age)
john = Person.new("john", 20)
not_jake = Person.new("john", 20)

john == not_jake # true

ImmutableStruct currently breaks this behaviour ( or more appropriately, doesn't offer this feature ).

👍

Reference implementations from Ruby 2.2.3:

Closing. Thanks @swanandp for reporting the issue!

Cool, thanks for adding this!