How do I in ruby create an instance of every class in each file in a directory and providing it as an array?
Thank you in advance!
How do I in ruby create an instance of every class in each file in a directory and providing it as an array?
Thank you in advance!
Assuming that they all share the same name as their containing .rb file and take no arguments to initialize...
You can use the
ObjectSpace
to find the new classes and then instantiate them.