diff --git a/lib/virtual/object.rb b/lib/virtual/object.rb index a60e4a9c..65b3269d 100644 --- a/lib/virtual/object.rb +++ b/lib/virtual/object.rb @@ -7,9 +7,17 @@ module Virtual class Object def == other return false unless other.class == self.class - attributes.each do |a| - left = send(a) - right = other.send(a) + Sof::Util.attributes(self).each do |a| + begin + 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 == right end