In my current project I am in need of a standard plugin mechanism where I
discover what plugins are available by what exists in a directory. I was
able to easily simply 'require' these ruby files in. However I want to take
it a step further and know (discover) what classes were in these files
including the module name so that I can interrogate them further and
potentially create them and call an initialize type method which might be
used to register yourself and or do other startup processing.
Is there an easy way to know what classes were loaded during the require or
is there a better way to do this sort of thing? I think the Rails plugin
mechanism works similarly to what I am looking for in that it loads plugins
from a directory and invokes an initialize method on each so they can do
their own registration/configuration work.
PS. It would also be nice if the plugins can use whatever module space they
want so there won't be class conflicts, so I would prefer suggestions and
ideas that might allow this functionality, so not only do I get the class
name but the actual module::class name so that I could create the proper
object using this information.
Thanks for any suggestions or help!
Jeff