class Foo; end
class A < Foo; end
class B; end

def tst(x)
  if x.class == Foo then puts "Same type."
    elsif x.is_a?(Foo) then puts "Extends type." 
    else puts "Not related."
  end
end

tst(Foo.new)
tst(A.new)
tst(B.new) 