T
tsuraan
I've been using python a lot lately, so I'll start with how that
works. In python, when you're dynamically loading code, you do
something like
module = __import__(mod_name_as_string, ...)
and then you have a module object that you can call methods on, etc.
In ruby, if I understand correctly, you can do
require some_string
and it parses that file and puts stuff into the global namespace. Is
there a sane way to determine exactly what was changed by that
require? Suppose I have a directory layout like this:
root/<mods>/plugin/<plugin_names>/plugin.rb
and I want to load all the plugin.rb files, I can use
Dir["root/*/plugin/#{name}/plugin.rb"] and then use require_relative
on the resulting list of strings, but how do I know what modules are
being defined in those plugin.rb files?
works. In python, when you're dynamically loading code, you do
something like
module = __import__(mod_name_as_string, ...)
and then you have a module object that you can call methods on, etc.
In ruby, if I understand correctly, you can do
require some_string
and it parses that file and puts stuff into the global namespace. Is
there a sane way to determine exactly what was changed by that
require? Suppose I have a directory layout like this:
root/<mods>/plugin/<plugin_names>/plugin.rb
and I want to load all the plugin.rb files, I can use
Dir["root/*/plugin/#{name}/plugin.rb"] and then use require_relative
on the resulting list of strings, but how do I know what modules are
being defined in those plugin.rb files?