Hi Sirs.
There is a difference between a bunch of methods that appear that they to the same job, but they won't.
The methods instance_of?, is_a? and kind_of? do related jobs, but not the same job.
For example is_a? and kind_of? do the same job, they return true if the caller is an instance of the method argument, if the caller is an instance of every superclass in his inheritance tree or if the argument method is a module included in the caller.
The instance_of? is more specific, it returns true just if the caller is an instance of the method argument.
Let me show some examples:
module Hand end class Animal end class Mamal < Animal include Hand end class Dog < Mamal end dog = Dog.new puts dog.instance_of?(Dog) # true puts dog.instance_of?(Mamal) # false puts dog.instance_of?(Animal) # false puts dog.instance_of?(Hand) # false puts dog.is_a?(Dog) # true puts dog.is_a?(Mamal) # true puts dog.is_a?(Animal) # true puts dog.is_a?(Hand) # true
Remember that is_a? and kind_of? do the same job.
See you.