From: Jeff Schwab Date: 2009-02-17T23:10:05+09:00 Subject: Re: load a Ruby source with params Sai Hl wrote: > Brian Candler wrote: >> (1) Loading in more Ruby code to the currently-running Ruby interpreter. >> This is done using "load" or "require". There is no concept of >> "parameters" here. However you could set a global variable (e.g. $foo) >> or a constant (Foo), which the code in the other file makes use of. >> >> But it would be more normal for the other file just to define modules or >> classes, and then after the load has completed you invoke one of those >> modules or classes, at which point you can pass whatever parameters you >> like. >> >> (2) Forking and execing a new child process. This could be another >> Ruby interpreter, but it could also be any other program on your system. >> When you do this, you can pass command-line arguments (and/or >> environment variables and open files) > I am going to try to use the (2) solutions Out of curiosity, why wouldn't you just define a function in the "other" file, then call it with whatever arguments you want? This is the second paragraph of (1).