Test if a module is a child of another module

Hello,

On the following example, how would you test if a module has another module as a parent or grand parent?

module MyModule
    module MySubModule
             module MySubSubModule end
    end
end

NOTE: I would prefer a solution that doesn’t compare the names of the modules because I’m worried that it would not be robust

parentmodule?

3 Likes

thanks! I’ll make a utility function that uses parentmodule and that will do :+1:

1 Like