Module: Toy::Equality
Instance Method Summary collapse
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
5 6 7 8 9 10 11 |
# File 'lib/toy/equality.rb', line 5 def eql?(other) return true if self.class.eql?(other.class) && id == other.id return true if other.respond_to?(:target) && self.class.eql?(other.target.class) && id == other.target.id false end |
#equal?(other) ⇒ Boolean
14 15 16 17 18 19 |
# File 'lib/toy/equality.rb', line 14 def equal?(other) if other.respond_to?(:proxy_respond_to?) && other.respond_to?(:target) other = other.target end super other end |
#hash ⇒ Object
21 22 23 |
# File 'lib/toy/equality.rb', line 21 def hash id.hash end |