I'm trying to read-in a folder full of "plug-ins" and call each of them,
in turn. Once I get the class-name, I do something like:
require "#{PLUG_IN_DIR}/#{one_plugin}"
plugin_class=Object.const_get(plugin_class_name).new
plugin_class.some_method
I *thought* that require worked a bit like the C pre-processor
"include", in that it would read and execute the named file at that
point, thereby defining my class and its methods. However, when I get
to the middle line, I get
uninitialized constant PluginClassName
Since rails is mistaking my class-name for a constant, I'm guessing that
require didn't execute the way I think it does, so my class-name isn't
initialized.
...Or maybe I've completely mis-diagnosed the problem.
At any rate, can someone offer a suggestion for how to read a folder
full of class-definition-files and, once at a time,
* Execute the class definition, so that my app knows about it
* Instantiate an instance of the class (I think we have this part,
above)
* Call a method on that class (should just be able to say
"a_class.a_method", right?)
Thanks!
···
--
Please take off your pants or I won't read your e-mail.
I will not, no matter how "good" the deal, patronise any business which sends
unsolicited commercial e-mail or that advertises in discussion newsgroups.