How to include multiple nested modules?

Hi everyone, I need help with a special request. I have a boot file that
require all the files and also have a begin function that is executed
before running all my other files. This function can now be called at
any time in my code. But it is dynamically referencing other libraries I
have and mixins and modules in that library. So at the moment I am
trying to include nested modules like this:

require_files ‘whitelabel’
include Pages::WhiteLabel::Community
include Pages::WhiteLabel::Games
include Pages::WhiteLabel::GettingStarted
include Pages::WhiteLabel::HelpFaq
include Pages::WhiteLabel::Home
include Pages::WhiteLabel::MyAccount
include Pages::WhiteLabel::Promotions
include Pages::WhiteLabel::Registration
include Pages::WhiteLabel::ShopOfJoy
include Pages::WhiteLabel::Vip
include Pages::WhiteLabel::Winners
include Pages::WhiteLabel::Magnolia
include Pages::WhiteLabel::Mixins

Now, my question is, without creating a separate file that reference
these modules, is it possible to do an “include” by doing a loop or
calling the Pages::Whitelabel module to get access to all the submodules
classes and methods?

its possable with this:

[:Community,:Games,:GettingStarted,:HelpFaq,:Home,:MyAccount,:Promotions,:Registration,:ShopOfJoy,:Vip,:Winners,:Magnolia,:Mixins].each
do |s|
include Pages::WhiteLabel.const_get(s)
end

or more dynamic:

Pages::WhiteLabel.constants.each do |s|
m= Pages::WhiteLabel.const_get(s)
if(m.instance_of?(Module))
include m
end
end

Thank you very much, that worked perfectly :slight_smile: