use the sof attributes for equality
This commit is contained in:
parent
28b4344ef9
commit
4b17a1e58f
@ -7,9 +7,17 @@ module Virtual
|
|||||||
class Object
|
class Object
|
||||||
def == other
|
def == other
|
||||||
return false unless other.class == self.class
|
return false unless other.class == self.class
|
||||||
attributes.each do |a|
|
Sof::Util.attributes(self).each do |a|
|
||||||
left = send(a)
|
begin
|
||||||
right = other.send(a)
|
left = send(a)
|
||||||
|
rescue NoMethodError
|
||||||
|
next # not using instance variables that are not defined as attr_readers for equality
|
||||||
|
end
|
||||||
|
begin
|
||||||
|
right = other.send(a)
|
||||||
|
rescue NoMethodError
|
||||||
|
return false
|
||||||
|
end
|
||||||
return false unless left.class == right.class
|
return false unless left.class == right.class
|
||||||
return false unless left == right
|
return false unless left == right
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user