t6d / smart_properties

Ruby accessors on steroids
MIT License
177 stars 20 forks source link

Object comparison with #== #41

Closed t6d closed 3 years ago

t6d commented 8 years ago

Two SmartProperties-enabled objects should be considered equal if they have their respective properties are equal.

amomchilov commented 2 years ago

Hey @t6d, may I ask why this was closed? It doesn't look like this was ever implemented:

class C
  include SmartProperties

  property! :a, accepts: Integer
  property! :b, accepts: Integer
end

C.new(a: 1, b: 2) == C.new(a: 1, b: 2) # => false
C.new(a: 1, b: 2).method(:==).owner # => BasicObject

I have a module I wrote that can be plugged in to add value-based equality. Would be interested in my contributing it?