Sep 11, 2011

Lesson learned: never use kind_of?

Always use respond_to?

I have found the problem when doing the integration test and invoke the function to process the notification queue.

Somehow, there are 2 processes doing this. So, the same class in a source file might refer to different classes (identical name, but different object_id).

This presents a problem to kind_of? because it will return false, even the inheritance is correct.

Strange enough, kind_of? is only wrong when you use it against its superclass. Therefore, I think instance_of? won't have this problem.