[#3006] CVS repository — "Eugene Scripnik" <hoaz@...>

Hello.

21 messages 2004/06/16
[#3008] Re: CVS repository — ts <decoux@...> 2004/06/16

>>>>> "E" == Eugene Scripnik <hoaz@gala.net> writes:

[#3009] Re: CVS repository — Michal Rokos <michal@...> 2004/06/16

Hi!

[#3057] Ruby 1.8.2 to be released. — matz@... (Yukihiro Matsumoto)

Hi,

20 messages 2004/06/23

Re: require && what has happened?

From: Joel VanderWerf <vjoel@...>
Date: 2004-06-14 19:21:18 UTC
List: ruby-core #2994
This might be a good question to ask on ruby-talk.

Michal Rokos wrote:
> in python i found that i can very easily do "plugins" by doing 
> execString = "import myModule as p" 
> eval(execString) 
> # now I have module MyModule as "variable" p 
> that as easy in ruby.?.?
> EOQ
> 
> I know that it isn't possible in ruby.... So he asked whether there is 
> some way to find out what has happened when he require something....
> 
> IFAIK there no way to find out what has happended.... Am I right?

I suggested a way to do something like this at

http://ruby-talk.org/100429

Briefly, the Script.load method loads a file and returns a module which 
you can use to access the top-level constants and methods defined in the 
file.

Script also defines #load and #require methods so that calling load and 
require from your script file first tries to find files relative to the 
script file, and, if found, wraps their top level constants and methods 
in the same module. If the files are not found, it falls back to 
Kernel#load and #require.

It's a trivial little piece of code, but I gave it a home at:

http://redshift.sourceforge.net/script/

In This Thread

Prev Next