From 95911166f3056af12529faf6d52d68b59a282149 Mon Sep 17 00:00:00 2001 From: Wojciech Piekutowski Date: Sun, 20 Feb 2011 17:01:57 +0100 Subject: [PATCH] Avoid using instance_variable_get on objects of other class --- lib/bson/types/object_id.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bson/types/object_id.rb b/lib/bson/types/object_id.rb index fcb0e3a..5d72b72 100644 --- a/lib/bson/types/object_id.rb +++ b/lib/bson/types/object_id.rb @@ -84,9 +84,9 @@ module BSON # Check equality of this object id with another. # - # @param [Mongo::ObjectId] object_id + # @param [BSON::ObjectId] object_id def eql?(object_id) - @data == object_id.instance_variable_get("@data") + object_id.kind_of?(BSON::ObjectId) and self.data == object_id.data end alias_method :==, :eql?