obj.class.ancestors
is probably you are looking for.